
import java.util.function.ToIntFunction;

public final class Demo {

	public static final <C extends Comparable<? super C>> int lowerBound(C[] array, C sought) {
		return lowerBound(array, 0, array.length, sought::compareTo);
	}

	public static <T> int lowerBound(T[] array, int low, int high, ToIntFunction<T> compare) {
		int i;
		for (i = low; i < high && compare.applyAsInt(array[i]) > 0; ++i) {
		}
		return i;
	}

}