FAQ: Learn Java: Loops - While We're Here

You’re missing the increment inside your while loop which is giving you an infinite loop I think. You need the +1 to make the count/number update and the loop continues for another iteration.