code: static int compareKeys(CharSequence key, ByteBuffer bytes, int offset) {
          for (int i = 0;; ++i, ++offset) {
              int c2 = bytes.get(offset);
              if (c2 == 0) {
                  if (i == key.length()) {
                      return 0;
                  } else {
                      return 1;  // key > table key because key is longer.
                  }
              } else if (i == key.length()) {
                  return -1;  // key < table key because key is shorter.
              }
              int diff = key.charAt(i) - c2;
              if (diff != 0) {
                  return diff;
              }
          }
      }
docs: Compares the length-specified input key with the
  NUL-terminated table key. (ASCII)