public static <T> int[] sort(
		final T array,
		final int length,
		final Comparator<? super T> comparator
	) {
		return sort(array, 0, length, 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, array.length,
    (a, i, j) -> Doubler.compare(a[i], a[j])
);
for (int i : sorted) {
    System.out.println(array[i]);
}
}

@param array the array which is sorted
@param length the array length
@param comparator the array element comparator
@param <T> the array type
@return the sorted index array
@throws NullPointerException if one of the arrays is {@code null}
@throws IllegalArgumentException if {@code length < 0}
jenetics/src/main/java/io/jenetics/util/ProxySorter.java