Check the code implementation below:
sort(T a, Comparator<? super T> c)
This works with 'Array of Objects' like Integer array. It doesn’t work for a primitive array such as an int array.
If you want to sort a primitive array in descending order, you have to first sort the array in ascending order and then reverse the array. This holds true for two-dimensional primitive arrays as well.
Interested in Java? Check out this Java Certification by Intellipaat.