class PrimitiveArraySorter {

    public static boolean sortAndMerge(short[] array, short[] mergeArray, int pivotIndex, int toIndex, ShortComparator comparator) {
        if (array.length == 1) return false;
        sort(array, 0, pivotIndex, comparator);
        if (pivotIndex == toIndex || comparator.compare(array[pivotIndex - 1], array[pivotIndex]) <= 0) {
            return false;
        }
        merge(array, mergeArray, pivotIndex, toIndex, comparator);
        return true;
    }

    private  PrimitiveArraySorter();

}