src/it/unimi/dsi/fastutil/Arrays.java
private static int lowerBound(int from, final int to, final int pos, final IntComparator comp) {
		// if (comp==null) throw new NullPointerException();
		int len = to - from;
		while (len > 0) {
			int half = len / 2;
			int middle = from + half;
			if (comp.compare(middle, pos) < 0) {
				from = middle + 1;
				len -= half + 1;
			}
			else {
				len = half;
			}
		}
		return from;
	}
private static int lowerBound(int from, final int to, final int pos, final IntComparator comp) {
		// if (comp==null) throw new NullPointerException();
		int len = to - from;
		while (len > 0) {
			int half = len / 2;
			int middle = from + half;
			if (comp.compare(middle, pos) < 0) {
				from = middle + 1;
				len -= half + 1;
			}
			else {
				len = half;
			}
		}
		return from;
	}
Performs a binary search on an already-sorted range: finds the first position where an
element can be inserted without violating the ordering. Sorting is by a user-supplied
comparison function.

@param from the index of the first element (inclusive) to be included in the binary search.
@param to the index of the last element (exclusive) to be included in the binary search.
@param pos the position of the element to be searched for.
@param comp the comparison function.
@return the largest index i such that, for every j in the range {@code [first..i)},
{@code comp.compare(j, pos)} is {@code true}.