BitField implements Comparable<BitField> { public boolean isSet(int bit) { int bite = byteForBit(bit); if (bite >= bits.length || bits.length == 0) { return false; } int bitOnByte = bitOnByte(bit, bite); return ((1 << bitOnByte) & bits[bite]) != 0; } BitField(); void set(int bit, boolean value); void set(int bit); void unset(int bit); boolean isSet(int bit); void ser(DataOutput out); int deser(DataInput in); int deser(byte[] bytes, int start); @Override int compareTo(BitField o); void clear(); String toString();  }
@Test public void testCornerCases() throws Exception { BitField bf = new BitField(); assertFalse(bf.isSet(24)); assertFalse(bf.isSet(0)); }