traverse the hashmap
for ( Map . Entry < Integer , Integer > kvp : mp . entrySet ( ) ) { System . out . println ( " Element ▁ " + kvp . getKey ( ) + " ▁ occurs ▁ " + kvp . getValue ( ) + " ▁ times " ) ; } }