Basically I'm writing a program that is suppose to print out all the prime numbers less than 500. This is what I have thus far. Does anyone have any suggestions that will help this program come to a close?




public class PN500 {

public static void main(String[] args) {
final int NUM_OF_PRIMES = 500;
int count = 1;
int n = 2;
boolean prime = true;

System.out.println("The first 50 prime numbers are \n");

while (n < =500) {
prime = prime(n);
if (prime (n))
System.out.println(n);
{

}
n++;
}


}


public static boolean prime(int n) {
boolean isPrime = true;

for (int divisor = 2; divisor <= n / 2; divisor++)

if (number % divisor == 0) {
isPrime = false;
break;
}

return isPrime;
}
}