package loops; import java.util.*; public class WhileLoopTest { public static void main(String[] args) { System.out.println("While Loop Test"); Random rand = new Random(); int count = 0; int randomInteger; while (count < 3) { randomInteger = rand.nextInt(2); System.out.println("Random integer generated: "+randomInteger); if (randomInteger == 0) count++; } System.out.println("Number of times 0 was generated: "+count); } }