int[] arr = new int[]{2,5,8,9,6,7,11,13,15,16,18,19,31,33,37,45};
int val=0,sum=0;
int min = arr[0];
for(int i=0;i<arr.length;i++){
boolean isPrime = true;
if(arr[i]==1){
isPrime = false;
}
else{
for(int j=2;j<arr[i]/2;j++){
if(arr[i]%j==0){
isPrime=false;
break;
}
}
}
if(isPrime){
System.out.println(arr[i] + " is a prime number in the array ");
for(int l=0;l<arr.length;l++){
if(min>arr[l]){
min=arr[l];
System.out.println("Min "+min);
}
}
val=val+arr[i];
}
}
System.out.println("Min "+min);
sum = val-min;
System.out.println("Sum "+sum);