I used the following code for sorting a 2D array of int[][] type in reverse order by making use of a comparator.
int[][] arr = {{2,3},{3,5},{5,8}};
Arrays.sort(arr, (a,b) -> Integer.compare(b[1], a[1]));
But I am unable to sort a 1D array of int[] type using similar approach. On the internet I found information saying "The only way to sort a primitive array in descending order is, first sort the array in ascending order and then reverse the array in place."
Why am I able to sort a 2D array of primitive type, but not a 1D array using comparator?