### Question:
BitSet { public int nextSetBit(int previous) { Preconditions.checkPositionIndex(previous, size); int longIndex = previous >> 6; if (longIndex >= array.length) { return -1; } long word = array[longIndex] & (-1L << previous); while (true) { if (word != 0) return (longIndex * 64) + Long.numberOfTrailingZeros(word); if (++longIndex == array.length) return -1; word = array[longIndex]; } } BitSet(int size); void set(int index); void set(int fromIndex, int toIndex); void clear(int index); void clear(); boolean get(int index); int cardinality(); boolean isEmpty(); int nextSetBit(int previous); int previousSetBit(int fromIndex); void copyAndClear(ConcurrentBitSet source); void orAndClear(ConcurrentBitSet source); void orXor(BitSet a, BitSet b); void or(BitSet a);  }### Answer:
@Test public void testNextSetBit() { BitSet bitSet = new BitSet(80); bitSet.set(15); bitSet.set(19); bitSet.set(17); assertEquals(15, bitSet.nextSetBit(0)); assertEquals(17, bitSet.nextSetBit(15 + 1)); assertEquals(19, bitSet.nextSetBit(17 + 1)); assertEquals(-1, bitSet.nextSetBit(19 + 1)); bitSet.clear(); bitSet.set(16); bitSet.set(79); assertEquals(16, bitSet.nextSetBit(0)); assertEquals(79, bitSet.nextSetBit(16 + 1)); assertEquals(-1, bitSet.nextSetBit(79 + 1)); bitSet.clear(); bitSet.set(78); bitSet.set(79); assertEquals(78, bitSet.nextSetBit(0)); assertEquals(79, bitSet.nextSetBit(78 + 1)); assertEquals(-1, bitSet.nextSetBit(79 + 1)); }