public static <T> int[] sort(
		final T array,
		final int from,
		final int to,
		final Comparator<? super T> comparator
	) {
		return TimProxySorter.sort(array, from, to, comparator);
	}
Sorting the given array by creating an index lookup array. The original
array is not touched, and the returned array can then be used for
iterating the array in ascending order.
{@snippet lang="java":
final double[] array = null; // @replace substring='null' replacement="..."
final int[] sorted = ProxySorter.sort(
    array, 5, array.length,
    (a, i, j) -> Doubler.compare(a[i], a[j])
);
for (int i : sorted) {
    System.out.println(array[i]);
}
}

@since 6.3

@param array the array which is sorted
@param from the index of the first element (inclusive) to be sorted
@param to the index of the last element (exclusive) to be sorted
@param comparator the array element comparator
@param <T> the array type
@return the sorted index array
@throws NullPointerException if one of the arrays or comparator is
        {@code null}
@throws IllegalArgumentException if {@code from > to}
@throws ArrayIndexOutOfBoundsException if {@code from < 0}
jenetics/src/main/java/io/jenetics/util/ProxySorter.java