I'm trying to print 10,000 random numbers in ascending and descending order using Arrays.sort then output it. If I try it as this, it does not give the right output.
import java.util.*;
import java.util.Random;
public class QuestionFour
{
public static void main(String[] args)
{
int arr[] = new int[10000];
Random rand = new Random();
for (int i=0; i<10000; i++)
{
arr[i] = rand.nextInt( 100 ) + 1;
Arrays.sort(arr);
System.out.println(arr);
}
}
}