public void clear(int startIndex, int endIndex) {
        assert startIndex >= 0;
        assert endIndex <= (wlen << 6);

        if (endIndex <= startIndex) return;

        int startWord = (startIndex >> 6);
        if (startWord >= wlen) return;

        // since endIndex is one past the end, this is index of the last
        // word to be changed.
        int endWord = ((endIndex - 1) >> 6);

        long startmask = -1L << startIndex;
        long endmask = -1L >>> -endIndex; // 64-(endIndex&0x3f) is the same as -endIndex
        // due to wrap

        // invert masks since we are clearing
        startmask = ~startmask;
        endmask = ~endmask;

        if (startWord == endWord) {
            setWord(startWord, word(startWord) & (startmask | endmask));
            return;
        }

        setWord(startWord, word(startWord) & startmask);

        int middle = Math.min(wlen, endWord);
        BitUtil.fillZero(bitsBase, bitsAddr, startWord + 1, middle);
        if (endWord < wlen) {
            setWord(endWord, word(endIndex) & endmask);
        }
    }
Clears a range of bits

@param startIndex lower index
@param endIndex   one-past the last bit to clear
indexr-common/src/main/java/io/indexr/util/DirectBitMap.java