title: Check the prime numbers in the array and return the sum of the prime numbers
body: <p>I tried to return the prime numbers in checkPrime. There must be some mistake in the checkPrime method itself and I cannot find it. What to do ?  the array is not returning any value </p>
  
  <pre><code>import java.util.*;
  public class addPrimeInArray{
      int total=0; int i,j;
  
      int checkPrime(int[] arr){
          for(i=0;i&lt;arr.length;i++) {
              boolean isPrime=true;
              for(j=2;j&lt;arr[i];j++){
                  if(arr[i]%j==0){
                      isPrime=false;
                      break;
                  }
              }
              if(isPrime) {
                  return(arr[i]);
              }
          }
          return(arr[i]);
      }
      int sum(int[] arr) {
          for(i=0;i&lt;arr.length;i++) {
              total=total+arr[i];
          }
          return(total);
      }
  
      public static void main(String[] args) {
          addPrimeInArray apa = new addPrimeInArray();
          int [] numbers = new int[3];
          numbers[0] = 1;
          numbers[1] = 2;
          numbers[2] = 3;
          for(int i: numbers) {
              System.out.print(i+" ");
          }
          apa.checkPrime(numbers);
          apa.sum(numbers);
      }
  }
  </code></pre>