private void compact() {
        int newCapacity = currentMaxPos + 1;
        if (capacity <= newCapacity) {
            return;
        }
        int[] newBase = new int[newCapacity];
        int[] newCheck = new int[newCapacity];
        System.arraycopy(base, 0, newBase, 0, newCapacity);
        System.arraycopy(check, 0, newCheck, 0, newCapacity);
        base = newBase;
        check = newCheck;
        capacity = newCapacity;
    }
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