private void ensureSize(int minSize) {
        if (capacity >= minSize) {
            return;
        }
        if (minSize > MAX_CAPACITY) {
            throw new IllegalArgumentException(
                    "The requested minimum size ("
                            + minSize
                            + ") must not exceed the maximum capacity "
                            + MAX_CAPACITY);
        }
        int newSize = Math.max(minSize, Math.min((int) (capacity * GROW_FACTOR), MAX_CAPACITY));
        int[] newBase = new int[newSize];
        int[] newCheck = new int[newSize];
        if (capacity > 0) {
            System.arraycopy(base, 0, newBase, 0, capacity);
            System.arraycopy(check, 0, newCheck, 0, capacity);
        }
        base = newBase;
        check = newCheck;
        capacity = newSize;
    }
currentMaxPos = max code + 1. Add 1 to avoid occupying the position of root
turms-plugins/turms-plugin-antispam/src/main/java/im/turms/plugin/antispam/core/ac/DoubleArrayTrie.java