h2/src/main/org/h2/util/Utils.java
/**
     * Find the top limit values using given comparator and place them as in a
     * full array sort, in descending order.
     *
     * @param array the array.
     * @param offset the offset.
     * @param limit the limit.
     * @param comp the comparator.
     */
Find the top limit values using given comparator and place them as in a
full array sort, in descending order.

@param array the array.
@param offset the offset.
@param limit the limit.
@param comp the comparator.
Find the top limit values using given comparator and place them as in a full array sort in descending order . @param array the array . @param offset the offset . @param limit the limit . @param comp the comparator .
public static <X> void sortTopN(X[] array, int offset, int limit,
            Comparator<? super X> comp) {
        partitionTopN(array, offset, limit, comp);
        Arrays.sort(array, offset, (int) Math.min((long) offset + limit, array.length), comp);
    }
public static < X > void sortTopN ( X [ ] array , int offset , int limit , Comparator < ? super X > comp ) { partitionTopN ( array , offset , limit , comp ) ; Arrays . sort ( array , offset , ( int ) Math . min ( ( long ) offset + limit , array . length ) , comp ) ; }
Find the top limit values using given comparator and place them as in a
 full array sort, in descending order.
Find the top limit values using given comparator and place them as in a full array sort in descending order .