I'm trying to sort an array in descending order in Java using this code:
for(int i = 0; i < arr.length; i++) {
Comparator comparator = Collections.reverseOrder();
Arrays.sort(arr,comparator);
}
But I get this error:
The method sort(int[]) in the type Arrays is not applicable for the arguments (int[], Comparator)