Hello Roy,

I have written small program which can be of help. Try it.

************************************************** *********************

public class PrimeList {

private static int[] primes ;

private static int count;

/** Creates a new instance of PrimeList */

public PrimeList() {

}

public static boolean testPrime(int i) {

boolean ret = false;

for(int j=2;j<i-1;j++) {

if(i%j == 0) {

ret = true;

}

}

return ret;

}

public static void display() {

for(int i=0;i<primes.length;i++) {

if(primes[i]!=0) {

System.out.print(primes[i]);

System.out.print("\t");

}

}

System.out.print("\n");

}

public static void main(String[] args) {

count =0;

primes = new int[5];

for(int i =1;i<100;i++) {

if(!testPrime(i)) {

if(count%5 ==0) {

display();

primes = new int[5];

count=0;

}

primes[count] = i;

count++;

//System.out.println(i);

}

}

display();

}

}

************************************************** *******************

"Roy J" <be******@comcast.net> wrote in message news:<G_5Fc.12154$IQ4.8981@attbi_s02>...

Hello everyone:)

My name is Roy, I am new to Java and I have problem regarding to arrays.

if you have time and like to help, please help.

I am trying to make a program to deal with prime numbers, but I do not how

to involve arrays with that.

program generates prime numbers according to user input, and displays them

in descending order. The user enters the number of prime numbers to be

generated. The output is displayed 5 numbers per row, 20 rows per screen.

If there are more than 100 numbers, the output should wait for the user to

press <Enter> before continuing to the next page. The program should repeat

until the user chooses to quit.

The "primelist" data structure must be implemented as a class with a private

array and a private counter for the number of elements. The class should

include methods to fill the array, display the array, etc.. The method to

test a number for "primeness" be a private method.

my quetion regarding the array stuff, how i can create a method to fill

array 5 number each row and display them in screen with display method?

thanks alot

waiting