void (int bitsPerChunk) { ConcurrentPackedBitsArray bitSet = ConcurrentPackedBitsArray.create(bitsPerChunk); ThreadLocalRandom rnd = ThreadLocalRandom.current(); for (int id = 0; id < 1 << 20; id++) { long bitsToWrite = bitsPerChunk == 64 ? rnd.nextLong() : rnd.nextLong(1L << bitsPerChunk); long bits = bitSet.get(id); assertEquals(0, bits, "Initially all bits are 0"); long previousBits = bitSet.set(id, bitsToWrite); assertEquals(0, previousBits, "Initially all bits are 0"); long bitsReadBack = bitSet.get(id); assertEquals(bitsToWrite, bitsReadBack, "Bits read back == bits written"); } }