int (int bitIndex) { if (myBase < 0) { throw new IllegalStateException(); } if (bitIndex >= myBase) bitIndex -= myBase; int wordIndex = bitIndex >> SHIFT; if (wordIndex > myLastUsedSlot) { return -1; } long word = myBitMask[wordIndex] & (-1L << bitIndex); while (true) { if (word != 0) { return (wordIndex * BITS_PER_WORD) + Long.numberOfTrailingZeros(word) + myBase; } if (++wordIndex > myLastUsedSlot) { return -1; } word = myBitMask[wordIndex]; } }