What I find helps me to look away from women who are inappropriately dressed is this. When I am put to the challenge, many times a day in NY, I remind myself that when I look away, I'm passing the difficult test of the desire. This time is a time of compassion from Hashem and the best time to pray for something. So as I'm walking and forcing myself to look the other way, I'm also praying for what I need and want from Hashem.
A few months ago my wife was pregnant, and I was praying for her to have an easy labor. When the time came to go to the hospital, the doctor could not belive how fast and painlessly she gave birth, without epidural!
It could have been my prayers or not, but its encouraging.