Stores the frequencies 's of  frequencies of array elements
HashMap < Integer , Integer > mp2 = new HashMap < Integer , Integer > ( ) ; for ( Map . Entry < Integer , Integer > it : mp1 . entrySet ( ) ) { if ( mp2 . containsKey ( it . getValue ( ) ) ) { mp2 . put ( it . getValue ( ) , mp2 . get ( it . getValue ( ) ) + 1 ) ; } else { mp2 . put ( it . getValue ( ) , 1 ) ; } }