private static int binarySearch(final int[] sequence, final int val, int length) {
    int i = Arrays.binarySearch(sequence, 0, length, val);
    assert i < 0;
    return -i - 1;
  }
private static int binarySearch(final int[] sequence, final int val, int length)