class Utilities{ public static int nextDoublePrime( int num ){ //WORK ON int notSureYet; //include isPRIME AND dblP for the conditions return notSureYet;; } private static boolean isPrime(int n){ //MAKE THIS WORK WITH NEXTDOUBLEPRIME AND DOUBLEPRIME change back to PRIVATE boolean isPrime = true; //assume the number is not a prime int divisor = 2; // rules that make it prime // loop // check if numbers less that X goes into it evenly X % div == 0 then isnt prime if(n != 1){ //1 is not a prime number while(isPrime && divisor < n){ //make sure the divisor is neever greater than n if(n % divisor == 0){ //if it does not have a remainder, its not prime isPrime = false; } divisor++; } } else{ //if n is 1, return false, cuz 1 is NOT prime isPrime = false; } return isPrime; } }

public class Test{ public static void main(String[] args){ //for isPrime, but its private int X = 53; System.out.println("The number " + X + " is prime: " + Utilities.isPrime(X)); } }

This post has been edited by **streek405**: 06 September 2013 - 10:43 AM