Map to store the rank of the array element
Map < Integer , Integer > ranks = new HashMap < > ( ) ; int rank = 1 ; for ( int index = 0 ; index < newArray . length ; index ++ ) { int element = newArray [ index ] ;