1 static boolean isPrime(int n){
2 boolean result=true;
3 if(n <= 1) return false;
4 for(int i = 2; i <= n/2; i++){
5 if(n % i == 0){
6 result = false; //if some number divides it, then prime=false;
7 break;
8 }
9 }
10 return result;
11 }