I have everything working, but it only displays a single number at a time, so I would have to click ok 1,000. Someone please help me display all numbers at once in a group of 10:

X=prime number

x x x x x x x x x x

x x x x x x x x x x

This is what I have:

/*Jeremy D Duenas Student#074193 Assignment5.1 CS212 */ import javax.swing.JOptionPane; public class FindPrime { public static void main (String[] args) { final int PRIMES = 1000;//Number of primes to display final int NUMBER_OF_PRIMES= 10; //Display 10 per line int count = 0;//Count number of prime numbers int number = 2; JOptionPane.showMessageDialog(null,"The first 1000 prime numbers are \n"); while (count < PRIMES) { boolean isPrime = true; int temp = number/2; //declare new variable for (int divisor = 2;divisor<=temp;divisor++) { if (number % divisor == 0) { isPrime = false; break; } } if (isPrime) { count++; if (count % PRIMES != 0) { JOptionPane.showMessageDialog(null,number + " "); } else JOptionPane.showMessageDialog(null, number + "."); } number++; } } }

Our hour is marked, and no one can claim a moment of life beyond what fate has predestined."

----Napoleon Bonaparte