You can do this:
public void greaterCounter(List<Integer> input){
for (Integer i : input){
Integer count = 0;
for (Integer j : input){
if (i < j)
count++;
}
System.out.print(i+","+count+" ");
}
}
2
solved How to get count of number elements which are greater than current element in an arraylist [closed]