// The following method returns a boolean indicating
// if the parameter is a prime number
private boolean isPrimeNaiveIter(int val) {
if(val == 0 || val == 1)
return false;
if(val == 2)
return true;
// Look for a divisor other than 1 and val
for(int div = 2; div*div <= val; div++) {
// if found return false
if(val % div==0)
return false;
}
// No divisors found => return it is a prime number
return true;
}