title: java unable to find the error to print a prime number
body: <p>This program gets 4 input from the user and prints out all the pairs except for the duplicate pairs. I wanted it print only the pairs that sum equals a prime number. I did the entire program there is no compilation error but in the output it prints to all pairs except the duplicate pair(i want it to print only the pair whose sum= a prime number) can anyone tell me what i am doing wrong   </p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.List;
  import java.util.Scanner;
  public class Prime {
      public static List&lt;Integer&gt; numbers = new ArrayList&lt;&gt;(); // a list of integers that was accepted, can be acced in the order they were added
      public static Scanner input = new Scanner(System.in);
      public static void main(String args[])
      {
          int inputs = 4; 
          input(inputs);
          for(int i = 0; i &lt; inputs; i++){ 
              for(int j = 0+i; j &lt; inputs; j++){
                  if(i != j) 
                      System.out.println(numbers.get(i)+ " + " + numbers.get(j) + " = "+ isPrime(numbers.get(i) + numbers.get(j)));                  
              }
          }   }   
  
      public static int isPrime (int sumPair)
      {
          boolean primeVal =true ;
          if(sumPair &lt; 2)
              primeVal= false;            
          else if(sumPair ==2)
              primeVal=true;         
          else if (sumPair % 2 == 0)
              primeVal = false;
          else
          {
              int stop = (int)Math.sqrt(sumPair);
              for (int d = 3; d &lt;= stop &amp;&amp; primeVal; d = d + 2)
              {
                  if (sumPair % d == 0)
                      primeVal = false;
              }
          }
          return(sumPair);
      }
  
      public static void input(int inputNumbers) 
      {
          while(numbers.size() &lt; inputNumbers){ // while there is more inputs needed
              System.out.print("Enter a positive integer: ");
              int num = input.nextInt();
              if(num &gt; 0) // if the input is valid
                  numbers.add(num);
              else // if the input is not valid
                  while (num &lt;= 0) { // while the input is not valid
                      System.out.print("Enter a positive integer: ");
                      num = input.nextInt(); // get the next int if it wasn't valid
                      if(num &gt; 0) { // if the input gets valid
                          numbers.add(num);
                      }
                  }
              System.out.println("Thank you.");
          }
      }
  
      public static int sumPair(int num1, int num2)
      {    
          return num1 + num2;
      }
  
  }
  </code></pre>