public static Quicksortable getQuicksortableIntArray ( final int [ ] array ) { return new Quicksortable ( ) { public void swap ( int i , int j ) { int t = array [ i ] ; array [ i ] = array [ j ] ; array [ j ] = t ; } public int compare ( int a , int b ) { int x = array [ a ] ; int y = array [ b ] ; if ( x < y ) return - 1 ; if ( x == y ) return 0 ; return 1 ; } } ; }
the sorting code contained in this class was copied from Arrays . java and then modified