docs: private static boolean validateTermWithStartValue(BytesRef term,
        ComponentTermVector termVector) {
      if (termVector.startValue == null) {
        return true;
      } else if (termVector.subComponentFunction.sortType
          .equals(CodecUtil.SORT_TERM)) {
        if (term.length > termVector.startValue.length) {
          byte[] zeroBytes = (new BytesRef("\u0000")).bytes;
          int n = (int) (Math
              .ceil(((double) (term.length - termVector.startValue.length))
                  / zeroBytes.length));
          byte[] newBytes = new byte[termVector.startValue.length
              + n * zeroBytes.length];
          System.arraycopy(termVector.startValue.bytes, 0, newBytes, 0,
              termVector.startValue.length);
          for (int i = 0; i < n; i++) {
            System.arraycopy(zeroBytes, 0, newBytes,
                termVector.startValue.length + i * zeroBytes.length,
                zeroBytes.length);
          }
          termVector.startValue = new BytesRef(newBytes);
        }
        if ((termVector.subComponentFunction.sortDirection.equals(
            CodecUtil.SORT_ASC) && (termVector.startValue.compareTo(term) < 0))
            || (termVector.subComponentFunction.sortDirection
                .equals(CodecUtil.SORT_DESC)
                && (termVector.startValue.compareTo(term) > 0))) {
          return true;
        }
      }
      return false;
    }