code: private int matchTail(int base, int index, String key) {
          int positionInTailArr = base - TAIL_OFFSET;
  
          int keyLength = key.length();
          for (int i = 0; i < keyLength; i++) {
              if (key.charAt(i) != tailBuffer.get(positionInTailArr + i)) {
                  return -1;
              }
          }
          return tailBuffer.get(positionInTailArr + keyLength) == TERMINATING_CHARACTER ? index : 0;
      }
docs: Check match in tail array
  
  @param base
  @param index
  @param key
  @return index if it is complete match. 0 if it is prefix match. negative value if it doesn't match