int A = 300;
int B = 400;
int C = 1000;
int D = 500;
int []abcd = {A,B,C,D};
Arrays.sort(abcd); // the sequence of array elements will be {300, 400, 500,1000}
What you want is a mapping from value to array location. Unless there's a way to get such a mapping out of Arrays.sort(), which I doubt (though I'm no Java expert), you'll need to generate the mapping yourself. You could do this by searching the array. It might be more efficient to implement your own sort so that you can keep track of the mapping as you sort the array.