public boolean clear(int index) {
        Storage32 newStorage = storage.clear(index);
        if (newStorage == null) {
            return true;
        }

        if (newStorage != storage) {
            storage = newStorage;
        }
        return false;
    }
@Test
    public void testClear() {
        // try to clear empty array
        actual.clear();
        verify();

        // try dense
        for (int i = 0; i < ARRAY_STORAGE_32_MAX_SPARSE_SIZE / 2; ++i) {
            set(i);
        }
        for (int i = 0; i < ARRAY_STORAGE_32_MAX_SPARSE_SIZE / 2 + 100; ++i) {
            clear(i);
            verify();
            // try nonexistent
            clear(i);
            verify();
        }

        // go sparse
        for (int i = 1000000; i < 1000000 + ARRAY_STORAGE_32_MAX_SPARSE_SIZE; ++i) {
            set(i);
        }
        for (int i = 1000000 + ARRAY_STORAGE_32_MAX_SPARSE_SIZE + 100; i >= 1000000; --i) {
            clear(i);
            verify();
            // try nonexistent
            clear(i);
            verify();
        }

        // test empty again
        actual.clear();
        verify();

        // try gaps
        for (int i = 0; i < 1000; ++i) {
            set(i * i);
        }
        for (int i = 0; i < 1000; ++i) {
            clear(i * i);
            verify();
        }

        // try larger gaps
        for (int i = (int) Math.sqrt(Integer.MAX_VALUE) - 1000; i < (int) Math.sqrt(Integer.MAX_VALUE); ++i) {
            set(i * i);
        }
        for (int i = (int) Math.sqrt(Integer.MAX_VALUE) - 1000; i < (int) Math.sqrt(Integer.MAX_VALUE); ++i) {
            clear(i * i);
            verify();
        }

        // try some edge cases
        for (int i = -2; i <= 2; ++i) {
            set(i);
        }
        for (int i = -2; i <= 2; ++i) {
            clear(i);
            verify();
        }
        for (int i = Short.MAX_VALUE - 2; i <= Short.MAX_VALUE + 2; ++i) {
            set(i);
        }
        for (int i = Short.MAX_VALUE - 2; i <= Short.MAX_VALUE + 2; ++i) {
            clear(i);
            verify();
        }
        for (int i = Short.MIN_VALUE - 2; i <= Short.MIN_VALUE + 2; ++i) {
            set(i);
        }
        for (int i = Short.MIN_VALUE - 2; i <= Short.MIN_VALUE + 2; ++i) {
            clear(i);
            verify();
        }
        for (long i = (long) Integer.MAX_VALUE - 2; i <= (long) Integer.MAX_VALUE + 2; ++i) {
            set((int) i);
        }
        for (long i = (long) Integer.MAX_VALUE - 2; i <= (long) Integer.MAX_VALUE + 2; ++i) {
            clear((int) i);
            verify();
        }
        for (long i = (long) Integer.MIN_VALUE - 2; i <= (long) Integer.MIN_VALUE + 2; ++i) {
            set((int) i);
        }
        for (long i = (long) Integer.MIN_VALUE - 2; i <= (long) Integer.MIN_VALUE + 2; ++i) {
            clear((int) i);
            verify();
        }
    }