Actually, I would use a do while loop here. Do while works like this:
The reason for preferring do while to an infinite loop and a break is that it is more clear to see when the loop terminates.Code:do { //code that repeats goes here } while(expression); //repeat until expression is false. //put code for what to do after the loop here.