Traverse through array elements and Count frequencies of all primes
for ( int i = 0 ; i < n ; i ++ ) { if ( prime . get ( arr [ i ] ) ) if ( mp . containsKey ( arr [ i ] ) ) mp . put ( arr [ i ] , mp . get ( arr [ i ] ) + 1 ) ; else mp . put ( arr [ i ] , 1 ) ; }