title: find all prime numbers from array
body: <p>I want to create a program that will ask the user to input 5 integers using array and determine all the prime numbers entered. But I have difficulty with it. What seems to be the problem? I use JCreator for this.</p>
  <pre><code>import java.util.Scanner;
  public class PrimeNumbers{
  public static void main (String[] args){
      int[] array = new int [5];
      Scanner in = new Scanner (System.in);
      
      System.out.println(&quot;Enter the elements of the array: &quot;);
      for(int i=0; i&lt;5; i++)
      {
          array[i] = in.nextInt();
      }
      //loop through the numbers one by one
      for(int i=0; i&lt;array.length; i++){
          boolean isPrime = true;
          
          //check to see if the numbers are prime
          for (int j=2; j&lt;array[i]; j++){
              
              if(array[i]%j==0){
                  isPrime = false;
                  break;
              }
          }
          //print the number
          if(isPrime)
  
              System.out.println(array[i] + &quot; are the prime numbers in the array &quot;);
      }
  }
  }
  </code></pre>