Skip to content

Instantly share code, notes, and snippets.

@Rassilion
Last active November 21, 2015 22:38
Show Gist options
  • Save Rassilion/e8c59723e49a4a80622b to your computer and use it in GitHub Desktop.
Save Rassilion/e8c59723e49a4a80622b to your computer and use it in GitHub Desktop.
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