There is a simple way to sort in java using Arrays.sort. However, is there anyway i can get an array of indexes which tells me whats the old position of that sorted element? For people who have used Matlab ( [sortval sortpos] = sort(z,'ascend') ), its the sortpos matrix.
z = [ 1 10 2 5 4 ]
When you sort you get:-
z_sorted = [ 1 2 4 5 10 ]
I also need an array like this:-
indexs = [ 1 3 5 4 2 ]
I know i can do some post processing on the sorted array to get this, however i was wondering if there is some inbuilt way in java (or some really quick way) of doing this.