code: SearchResult search(@NonNull ByteArraySegment key, int startPos) {
          // Positions here are not indices into "source", rather they are entry positions, which is why we always need
          // to adjust by using entryLength.
          int endPos = getCount();
          Preconditions.checkArgument(startPos <= endPos, "startPos must be non-negative and smaller than the number of items.");
          while (startPos < endPos) {
              // Locate the Key in the middle.
              int midPos = startPos + (endPos - startPos) / 2;
  
              // Compare it to the sought key.
              int c = KEY_COMPARATOR.compare(key.array(), key.arrayOffset(),
                      this.data.array(), this.data.arrayOffset() + midPos * this.config.entryLength, this.config.keyLength);
              if (c == 0) {
                  // Exact match.
                  return new SearchResult(midPos, true);
              } else if (c < 0) {
                  // Search again to the left.
                  endPos = midPos;
              } else {
                  // Search again to the right.
                  startPos = midPos + 1;
              }
          }
  
          // Return an inexact search result with the position where the sought key would have been.
          return new SearchResult(startPos, false);
      }
docs: Performs a (binary) search for the given Key in this BTreePage and returns its position.
  
  @param key      A ByteArraySegment that represents the key to search.
  @param startPos The starting position (not array index) to begin the search at. Any positions prior to this one
  will be ignored.
  @return A SearchResult instance with the result of the search.