Sam,
I'm not really sure what the problem is. I couldn't immediately see a problem with the code, so I compiled it myself. Using the same inputs you used, this is my result:
This, as far as I can tell
is the intended output. If this isn't what you're getting, perhaps it has something to do with a configuration issue. What version of
Java are you using? I'm using Java 1.4.0.
If you were expecting something else, let me know and I can try to help you some more.
Corey