A workplace is a place where we spend the majority of our day.
It is important to set some boundaries and stick to them. This does not only apply to cases where one might need to deal with unwanted sexual advances, but to any situation in the office.
The goal is to set your rules and stick to them.
Your time, your work and most definitely your body should solely be in your control.
Sounds cliched, but NO means NO and you have to be firm with it.
Any unwanted behaviour should be promptly be raised with the management. If anyone makes you uncomfortable with their lewd jokes, do not take it lightly voice your discomfort. You are entitled to a safe and comfortable workplace.
Also, if you want to prevent despicable acts please raise your voice to help colleagues as well and do not wait till the incident directly affects you.
Most importantly, go to work with an open mind, do not bucket colleagues solely into gender-based groups. It is important to remember that men and women are not inherently bad, it is for us to identify and strictly deal with the ones who are not keeping in line with the requirements of the decent professional world.