Skip to content

Instantly share code, notes, and snippets.

@joshuaherman
Last active August 2, 2016 02:19
Show Gist options
  • Save joshuaherman/a9c2e87336658fefb0e64d2919ce64be to your computer and use it in GitHub Desktop.
Save joshuaherman/a9c2e87336658fefb0e64d2919ce64be to your computer and use it in GitHub Desktop.
isPrime - Java
static boolean isPrime(<T> num) {
if (num == 1 || num == 2 || num == 3 || num == 5 || num == 7) {
return true;
}else if (num % 2 == 0 || num % 5 == 0 || num % 3 == 0) {
return false;
}else{
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment