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}
A naive way to do it would be to go through each element of the array, checking the values as you go:
for (int i = 0; i < abcd.length; i++)
{
if (abcd[i] == A)
{
A = i+1;
}
}
// Rinse and repeat for B, C, D
If going down this approach, of course, turn it into a function that accepts the array, the value to search for, and returns its index within the array.