@Override
    public void updateLevel(int level) {
        Preconditions.checkArgument(
                level >= 0 && level <= MAX_LEVEL,
                "level(" + level + ") must be non-negative and no more than " + MAX_LEVEL);
        Preconditions.checkArgument(
                level <= this.topLevel + 1,
                "top level "
                        + topLevel
                        + " must be updated level by level, but new level is "
                        + level);

        if (levelIndex.length < level) {
            long[] newLevelIndex = new long[this.levelIndex.length * 2];
            initLevelIndex(newLevelIndex);
            System.arraycopy(this.levelIndex, 0, newLevelIndex, 0, this.levelIndex.length);
            this.levelIndex = newLevelIndex;
        }

        if (topLevel < level) {
            topLevel = level;
        }
    }
@Test
    void testUpdateToNegativeLevel() {
        assertThatThrownBy(() -> heapHeadIndex.updateLevel(-1))
                .isInstanceOf(IllegalArgumentException.class);
    }