Last active
November 21, 2015 22:38
-
-
Save Rassilion/e8c59723e49a4a80622b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private boolean isPrime(int number){ | |
for (int i = 2; i <= Math.sqrt(number); i++) { | |
if (number%i==0) { | |
return false; | |
} | |
} | |
return true; | |
} | |
private int getPrimeNumber(int number) { | |
if (number%2== 0) { | |
number+=1; | |
} | |
while (!isPrime(number)) { | |
number+=2; | |
} | |
return number; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment