BitSetMath { public static int increment(BitSet i) { int tsb = i.nextClearBit(0); i.set(tsb); i.clear(0, tsb); return tsb; } private  BitSetMath(); static int increment(BitSet i); static void rotate(BitSet bs, int n, int count); static void extractBitRange(BitSet chi, int from, int to, BitSet r); static void grayCode(BitSet i); static void grayCodeInverse(BitSet i); static void copy(BitSet from, BitSet to); static long littleEndianBitSetToNonNegativeLong(BitSet bs); static void nonNegativeLongToLittleEndianBitSet(long value, BitSet bs);  }
@Test public void increment() { BitSet actual = new BitSet(); for (int i = 0; i < 64; ++i) { BitSet expected = TestUtils.unsignedIntToLittleEndianBitSet(i); Assert.assertEquals(expected, actual); BitSetMath.increment(actual); } }