text: Traversing through original array and printing all those elements that are in first k of sorted array . goo . gl / uj5RCD Please refer https : for details of Arrays . binarySearch ( )
code: for ( int i = 0 ; i < n ; ++ i ) if ( Arrays . binarySearch ( brr , arr [ i ] , Collections . reverseOrder ( ) ) >= 0 && Arrays . binarySearch ( brr , arr [ i ] , Collections . reverseOrder ( ) ) < k ) System . out . print ( arr [ i ] + " ▁ " ) ; }