Return string with occurrence equals to sec_max
itr = occ . entrySet ( ) . iterator ( ) ; while ( itr . hasNext ( ) ) { Map . Entry < String , Integer > entry = itr . next ( ) ; int v = entry . getValue ( ) ; if ( v == sec_max ) return entry . getKey ( ) ; } return null ; }