code: public void add(byte[] sequence, int start, int len) {
      assert serialized != null : "Automaton already built.";
      assert previous == null || len == 0 || compare(previous, 0, previousLength, sequence, start, len) <= 0 : "Input must be sorted: "
          + Arrays.toString(Arrays.copyOf(previous, previousLength))
          + " >= "
          + Arrays.toString(Arrays.copyOfRange(sequence, start, len));
      assert setPrevious(sequence, start, len);
  
      // Determine common prefix length.
      final int commonPrefix = commonPrefix(sequence, start, len);
  
      // Make room for extra states on active path, if needed.
      expandActivePath(len);
  
      // Freeze all the states after the common prefix.
      for (int i = activePathLen - 1; i > commonPrefix; i--) {
        final int frozenState = freezeState(i);
        setArcTarget(nextArcOffset[i - 1] - ARC_SIZE, frozenState);
        nextArcOffset[i] = activePath[i];
      }
  
      // Create arcs to new suffix states.
      for (int i = commonPrefix + 1, j = start + commonPrefix; i <= len; i++) {
        final int p = nextArcOffset[i - 1];
  
        serialized[p + FLAGS_OFFSET] = (byte) (i == len ? BIT_ARC_FINAL : 0);
        serialized[p + LABEL_OFFSET] = sequence[j++];
        setArcTarget(p, i == len ? TERMINAL_STATE : activePath[i]);
  
        nextArcOffset[i - 1] = p + ARC_SIZE;
      }
  
      // Save last sequence's length so that we don't need to calculate it again.
      this.activePathLen = len;
    }
docs: Add a single sequence of bytes to the FSA. The input must be
  lexicographically greater than any previously added sequence.
  
  @param sequence The array holding input sequence of bytes.
  @param start Starting offset (inclusive)
  @param len Length of the input sequence (at least 1 byte).