A rule of thumb that I learned was to sit on the bike in a normal, comfortable position with hands on the bars. Then look down at your front hub. The proper stem will place the handlebars right in the line of sight to the bolts of your front hub.
If the bars are ahead of the bolts, the stem is too long. If the bars are behind the bolts, then the stem is too short.
This isn't an exact science, but it is a good starting point.
Remember, you can also adjust your seat rails on the post to go up and back as well.