docs: public static int advanceUntil(short[] array, int pos, int length, short min) {
      int lower = pos + 1;
  
      // special handling for a possibly common sequential case
      int imin = toIntUnsigned(min);
      if (lower >= length || toIntUnsigned(array[lower]) >= imin) {
        return lower;
      }
  
      int spansize = 1; // could set larger
      // bootstrap an upper limit
  
      while (lower + spansize < length
          && toIntUnsigned(array[lower + spansize]) < imin) {
        spansize *= 2; // hoping for compiler will reduce to
      }
      // shift
      int upper = (lower + spansize < length) ? lower + spansize : length - 1;
  
      // maybe we are lucky (could be common case when the seek ahead
      // expected
      // to be small and sequential will otherwise make us look bad)
      if (array[upper] == min) {
        return upper;
      }
  
      if (toIntUnsigned(array[upper]) < imin) {
        // means array has no item >= min pos = array.length;
        return length;
      }
  
      // we know that the next-smallest span was too small
      lower += (spansize >>> 1);
  
      // else begin binary search
      // invariant: array[lower]<min && array[upper]>min
      while (lower + 1 != upper) {
        int mid = (lower + upper) >>> 1;
        short arraymid = array[mid];
        if (arraymid == min) {
          return mid;
        } else if (toIntUnsigned(arraymid) < imin) {
          lower = mid;
        } else {
          upper = mid;
        }
      }
      return upper;
  
    }