When you are unsure about what condition to put in while loop but you just want a harmless loop and the condition you want to stop is inside the loop (which consists of either break or return, in java), then you can use while(true). So while(true){} basically keeps looping until any condition to exit the loop is met inside the loop, or else it will keep looping infinite times.