public boolean isPrime(int x){ if(x % 2 == 0 && x > 2) return false; if(x <= 1){ return false; } if(x == 2){ return true; } for(long i = 3; i < Math.sqrt(x); i+=2){ if(x % i == 0) return false; } return true;
If I pass through any integer that's a square of a prime number.. It returns with true. So...
Input: 25
Output: "Prime: True"
Input: 49
Output: "Prime: True"
SOLVED: Sorry guys... I just solved it.. Within the For Loop, I never checked for the square root of "x".. So the odd squares would return true..