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