This is from my boyfriend to you!
if you get unwanted erections in public, do the following
Tuck it Up
You can also tuck your erection up into your jeans by just standing it upright so it's flat against your stomach. If it's more of a semi you may be able to pin it down against your leg. Either way this will make it much flatter against your body so it doesn't protrude so much. Just make sure there's not a tip sticking out the top of your jeans – now that is embarrassment.
Hand in the Pocket
Another way to do this effectively is to put your hand in your pocket and to push it forward slightly. This then makes brings your jeans to the same height as the area where your erection is meaning it won't stand out. It can though look a little unusual that you have your hand in your pocket at all.
Most of all though, it is important to just act natural as far as possible. What you have to remember is that in most cases no one is going to be looking at your crotch – if they are then it's them who is unusual and should be embarrassed. Shifting around will only draw attention to it, so if you can't hide it then just act like it's not there. Engage them with your conversation and hopefully they won't be looking at your crotch.