Is this okay?

So I was at school today (16 y/o) and my teacher (a guy) told me in front of the entire class to go to the main office for a dress code violation of the second rule (which is shirts being too low cut). This was really embarrassing because now the whole class was staring at my tits and I wish he would've just talked to me in private. Then a girl in my class who was wearing a shirt that was really similar and just as low cut said why her and he said because she has something to show and you don't (she's flat chested and I have D cups). I didn't want to argue with him because I was really embarrassed and because he's my teacher so I just took my stuff and went. I didn't tell anyone at the main office what happened because I wasn't sure if it was anything he could get in trouble for. They let me off the hook because I've never been written up before and I'm on honor society. Is this okay??