I have two int arrays
int[] sum=new int[n];
int[] newTime=new int[n];
- First: 1 5 3
- Second 10 15 13
Arrays.sort(sum);
- Prints 1 3 5
What I want is even for the second array to be sorted with the same indexes of the
- first=>second : 10 13 15
I have tried with maps:
SortedMap<Integer, Integer> m = new TreeMap<Integer, Integer>();
for(int i = 0; i < priorities.length; i++){
m.put(sum[i],newTime[i]);
}
It just sorts the first array only,the indexes of the second array don't change.Help is appreciated! Thank You!
Arrays.sort(newTime);? Again I don't get what are you trying to achieve. What is the use case ?