title: Loop to keep asking for guesses when picking numbers in an array (java)
body: <p>I am writing code to Generate an Array of 100 random numbers between 1 and 100 . 
  I then want to ask the user for a number and then search for that number in the array. If the number is present i want to remove it from the array and ask the user for another number. I want to repeat this until the user guesses
  incorrectly. If the user guesses incorrectly, I want to output the remaining Array contents in reverse order. </p>
  
  <p>I think I have everything written correctly, but here is my <strong>Question</strong>; <strong>I can't get my head around how to have the program keep asking if the guesses are correct.</strong> </p>
  
  <p>Here is my code, I know it's just a well placed for loop that is needed,I just can't see where. I would really appreciate some help on this. Thank you! I'm not looking for someone to give me the code needed just a steer.</p>
  
  <pre><code>int[] randomArray = new int[10];
      // For loop to fill the array with random elements from 1 to 100
      for (int i = 0; i &lt; randomArray.length; i++) {
          randomArray[i] = (int) (Math.random() * 100);
          // Print the array
          System.out.print(randomArray[i] + ", ");
      }
      // Print a blank line
      System.out.println();
  
  Scanner input = new Scanner(System.in);
      // Declare an int variable to hold the number
      int searchNumber;
      // Ask the user to enter a number
      System.out.println("Please enter a number to search for between 1 and 
  100: ");
      // Initialise the int variable with the number entered
      searchNumber = input.nextInt();
  
      // initialise boolean as false
      boolean found = false;
      // for loop to search the array for the value entered by the user
      for (int i = 0; i &lt; randomArray.length; i++) {
          if (searchNumber == randomArray[i]) {
              // If found then set boolean to true
              found = true;
              // If found print out the index where it was found and inform 
  the user that it
              // will be removed from the array
              System.out.println("Your number was found at index " + i + " 
  and will be deleted from the array:");
  
              // create a new array which is one element shorter than the 
  original
              int[] result = new int[randomArray.length - 1];
              // Copy the the new array from the original array
              System.arraycopy(randomArray, 0, result, 0, i); // i is the 
  element to be removed
              System.arraycopy(randomArray, i + 1, result, i, result.length - 
  i);
              // Print the new array without the element i
              System.out.println(Arrays.toString(result));
  
          }
      }
  
      // code to inform the user if their value was not found and print the 
  array in
      // reverse
      if (!found) {
          // Print text telling the user that the number was found and the 
  array will be
          // printed in reverse
          System.out.println("Your number was not found, here is the array in 
  reverse");
          // For loop to print the array in reverse
          for (int k = randomArray.length - 1; k &gt;= 0; k--)
              System.out.print(randomArray[k] + ", ");
  
      }
  
  }
  </code></pre>