I'm trying to do descended sort with Double
values.
Double[] test = {7.0, 2.0, -5.0, 5.0, 9.0};
Arrays.sort(test, Collections.reverseOrder());
System.out.println(Arrays.toString(test)); // [9, 7, 5, 2, -5]
So far, it looks good. But I need to get the index for the sorting as well. How can I do that?
I know that the sorted index did go from 0 1 2 3 4
to 4 0 3 1 2
.
How can I get that index?