Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static boolean isPrime(int input) {
- int j = 0;
- if(input%2==0){
- return false;
- }
- else{
- for (int i = 1; i <= Math.sqrt(input); i++) {
- if (input % i == 0) {
- j = j+2;
- }
- }
- if (j <= 2) {
- return true;
- }
- return false;
- }
- }
Add Comment
Please, Sign In to add comment