Bit { public static final boolean isSet(byte b, int mask) { return (b & mask) == mask; } private  Bit(); static final boolean isSet(byte b, int mask); static final int B1; static final int B2; static final int B3; static final int B4; static final int B5; static final int B6; static final int B7; static final int B8; }
@Test public final void testAllBitsSet() { final byte b = Hex.decode("ff")[0]; Assert.assertTrue(Bit.isSet(b, Bit.B1)); Assert.assertTrue(Bit.isSet(b, Bit.B2)); Assert.assertTrue(Bit.isSet(b, Bit.B3)); Assert.assertTrue(Bit.isSet(b, Bit.B4)); Assert.assertTrue(Bit.isSet(b, Bit.B5)); Assert.assertTrue(Bit.isSet(b, Bit.B6)); Assert.assertTrue(Bit.isSet(b, Bit.B7)); Assert.assertTrue(Bit.isSet(b, Bit.B8)); }
@Test public final void testBit1() { Assert.assertTrue(Bit.isSet((byte) 1, Bit.B1)); Assert.assertFalse(Bit.isSet((byte) 0, Bit.B1)); }
@Test public final void testBit8() { final byte b = Hex.decode("f0")[0]; Assert.assertTrue(Bit.isSet(b, Bit.B8)); }