boolean (int bitIndex) { boolean set = contains(bitIndex); if (!set) { if (myBase < 0) { myBase = roundToNearest(bitIndex); } else if (bitIndex < myBase) { int newBase = roundToNearest(bitIndex); int wordDiff = (myBase - newBase) >> SHIFT; long[] n = new long[wordDiff + myBitMask.length]; System.arraycopy(myBitMask, 0, n, wordDiff, myBitMask.length); myBitMask = n; myBase = newBase; myLastUsedSlot += wordDiff; } ++myBitsSet; bitIndex -= myBase; int wordIndex = bitIndex >> SHIFT; if (wordIndex >= myBitMask.length) { myBitMask = ArrayUtil.realloc(myBitMask, Math.max(calcCapacity(myBitMask.length), wordIndex + 1)); } myBitMask[wordIndex] |= 1L << (bitIndex & MASK); myLastUsedSlot = Math.max(myLastUsedSlot, wordIndex); } return !set; }