static binarySearchForTransitionFromTrueToFalse(max, argIsBeforeTransitionFunc) {
        let min = 0;
        while (max > min) {
            let med = min + Math.floor((max - min) / 2);
            if (argIsBeforeTransitionFunc(med)) {
                min = med + 1;
            } else {
                max = med;
            }
        }
        return min;
    }
Performs a binary search, looking for the first index to return false under the constraint that the given
function returns true for all arguments less than some index and false afterwards.

@param {!int} max Determines the range to search over. Valid inputs to the query function are non-negative
integers up to this maximum than this count.
@param {!function(!int) : !boolean} argIsBeforeTransitionFunc Determines if the transition happens before or
after the given index.
@returns {!int}