I have an array which consists of 10 random integers, what will be the fastest way to sort it from the largest to the smallest?
public class Main {
public static void main(String args[])
{
int [] array = new int[10];
array[0] = ((int)(Math.random()*100+1));
array[1] = ((int)(Math.random()*100+1));
array[2] = ((int)(Math.random()*100+1));
array[3] = ((int)(Math.random()*100+1));
array[4] = ((int)(Math.random()*100+1));
array[5] = ((int)(Math.random()*100+1));
array[6] = ((int)(Math.random()*100+1));
array[7] = ((int)(Math.random()*100+1));
array[8] = ((int)(Math.random()*100+1));
array[9] = ((int)(Math.random()*100+1));
for (int i = 0; i < 10; i++){
System.out.println(i + ") " + array[i]);
}
}
}
The only thing that comes to mind is bubble sort and the insertion sort