I want to sort an array and find the index of each element in the sorted order. So for instance if I run this on the array:
[3,2,4]
I\'d ge
import java.util.*; public class Testing{ public static void main(String[] args){ int[] arr = {3, 2, 4, 6, 5}; TreeMap map = new TreeMap(); for(int i = 0; i < arr.length; i++){ map.put(arr[i], i); } System.out.println(Arrays.toString(map.values().toArray())); } }