Random generator = new Random(); int integerArray[20]; int foundSeven=0; int i; for (i=0; i<20; i++) { integerArray[i] = generator.nextInt(); if ((integerArray[i]==7)&&(foundSeven==0)) { foundSeven = 1; println("Found the number 7 at position " + i); }// end if } // end for