public int getBitCount()
    {
        return bitSet.cardinality();
    }
@Test
    public void testGetBitCount()
    {
        int length = 1024;
        Bitmap bitmap = new Bitmap(length);
        assertEquals(bitmap.getBitCount(), 0); // all zeros at initialization
        for (int i = 0; i < length; i++) {
            bitmap.setBit(i, true);
            assertEquals(bitmap.getBitCount(), i + 1); // i + 1 "true" bits
        }
    }