4445464748495051525354
field = new BitField(); field.set(0, 500, true); for (int i = 0; i < 100000; i++) { int a = random.nextInt(120); int b = a + 1 + random.nextInt(200); field.clear(a); field.clear(b); assertEquals(b, field.nextClearBit(a + 1)); field.set(a); field.set(b); }
4546474849505152535455
field.set(0, 500, true); for (int i = 0; i < 100000; i++) { int a = random.nextInt(120); int b = a + 1 + random.nextInt(200); field.clear(a); field.clear(b); assertEquals(b, field.nextClearBit(a + 1)); field.set(a); field.set(b); } }
9899100101102103104105106107108
if (random.nextBoolean()) { if (random.nextBoolean()) { bits.set(idx); set.set(idx); } else { bits.clear(idx); set.clear(idx); } } else { assertEquals(set.get(idx), bits.get(idx)); assertEquals(set.nextClearBit(idx), bits.nextClearBit(idx));