import java.util.Arrays;
import java.util.*;
class Main {
public static void main(String[] args) {
}
}
class List {
private static final int NUMINTS = 10;
public List(int numints) {
int list[];
list = new int[NUMINTS];
}
public void fillWithRandom(int list[]) {
Random r;
r = new Random();
int i;
for(i=0; i < NUMINTS ; i++)
list[i] = r.nextInt();
}
public void print(int list[]) {
int i;
System.out.println("before sort():");
for(i=0 ; i < NUMINTS; i++)
System.out.println(list[i]);
Arrays.sort(list, 0, NUMINTS);
System.out.println("--------");
System.out.println("after sort():");
for (i = 0 ; i < NUMINTS; i++)
System.out.println(list[i]);
}
}
I want to create an array of random numbers. I am not quite sure how to implement the methods from my class List into the Main class. I want main to create the array and then print it out.