when your 4 months and another way you can tell is if in 3 months your pregnant and you feel like a cramp its the baby moving and its a boy because the girls are more lazy they move until 5 or 6 months they'll move a little but not alot like the boys that should help you
you can find out at your 20 week ultra sound sometimes thats before 20 weeks but its usually between 18-21 weeks... just keep in mind tey aren't always right and sometimes they cant tell but if the babys in the wrong position you can get another one to detrimine the sex but you might have to pay for it... good luck!!!
In the Uk they will scan you at 20 weeks and you can find out then if the baby lets you know sometimes they are not in a good position for you to see!!!
Some hospitals dont tell you the sex, but if your eager to know around 16 weeks upwards they can tell depending on position. If the hospital doesnt let you know there are private clinics that do sexing especially but for a fee. I wanted to know but the hospital didnt tell me, i was gutted but the i suppose it was a surprise in the end