After sorting the array, you can simple iterate through each of the array elements and print out the index for each of them.
for(int i = 0; i < arr.length; i++) {
System.out.println(arr[i] + " is at the position " + (i + 1));
}
Note that you need to use i + 1
since arrays have 0-based index.
0
solved Java Sorting alphabet and get position number [closed]