Im working on a task where i need to randomize a user specified amount of numbers between 0 and 999 with the help of an array. Then i need to create two new Arrays sorting the numbers from the previous array one with the numbers ranging from 0 to 499 and one with the numbers between 500 and 999. Its important that the arrays have an exact size of the amount of numbers that needs to go in them, thats why im using a arraylist. Would appreciate some tips on how to do this!
here is my code so far:
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("How many random numbers? 0 – 999 do you want? ");
int varde = in.nextInt();
System.out.print("");
System.out.println("Here are your numbers:");
int randomArray[]=new int[varde];
for(int i = 0; i<varde; i++)
{
randomArray [i] = (int) (Math.random () * 999);
System.out.print(" "+randomArray[i]);
ArrayList lowNumbers = new ArrayList();
if (randomArray.equals(""))
{
lowNumbers.add(randomArray);
System.out.println("Low Numbers: "+lowNumbers);
}
}