Stores the new array elements
int ans [ ] [ ] = new int [ arr . length ] [ 2 ] ; for ( int i = 0 ; i < arr . length ; i ++ ) ans [ i ] = new int [ ] { keyFunc ( arr [ i ] ) , arr [ i ] } ; return ans ; }