Welcome to the Forum! Please read
this topic to learn how to post code correctly and other useful tips for newcomers.
Just so you know . . . you updated your original post - a good thing, but that doesn't provide notification to those who may be interested or bring it back as a "New Post," which many of us key on. You can add a reply, "Fixed post," or something like that to let people know.
As for your problem - you don't have one, at least not the one you think you do. What happens if you add a statement like:
System.out.println( "Iteration #: " + iterationNum );
right before the closing brace and while() statement?