public void setBit(int position, boolean value)
    {
        bitSet.set(position, value);
    }
@Test
    public static void testSetBit()
    {
        Bitmap bitmap = new Bitmap(24);

        // This should create the following bitmap:
        // 00000011_00000101_01010101
        bitmap.setBit(0, true);
        bitmap.setBit(1, true);
        bitmap.setBit(8, true);
        bitmap.setBit(10, true);
        bitmap.setBit(16, true);
        bitmap.setBit(18, true);
        bitmap.setBit(20, true);
        bitmap.setBit(22, true);

        byte[] bytes = bitmap.toBytes();
        assertEquals(bytes[0], 0b00000011);
        assertEquals(bytes[1], 0b00000101);
        assertEquals(bytes[2], 0b01010101);

        // Now clear bits in positions 10+
        // This bitmap should now be:
        // 00000011_00000001 [_00000000] (the last byte will be truncated in toBytes())
        for (int i = 10; i < 24; i++) {
            bitmap.setBit(i, false);
        }

        bytes = bitmap.toBytes();
        assertEquals(bytes.length, 2);
        assertEquals(bytes[0], 0b00000011);
        assertEquals(bytes[1], 0b00000001);
    }