Finding the length of the frequency array
int z = a [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { if ( a [ i ] > z ) z = a [ i ] ; } z = z + 1 ; int [ ] ff = new int [ z ] ; for ( int i = 0 ; i < n ; i ++ ) {