### Question:
BitReader { public boolean readBoolean(){ int i = bits / 8; if(i >= data.length){ throw new IllegalStateException("No more data to read"); } byte b = data[i]; int k = bits % 8; bits++; return ((b >>> (8 - k - 1)) & 1) == 1; } BitReader(byte[] data); byte readByte(); boolean readBoolean(); int readInt(); int readInt(int nbits); char readChar();  }### Answer:
@Test public void testBoolean(){ byte val = (byte)0b1000_0000; BitReader reader = new BitReader(new byte[]{val}); boolean b = reader.readBoolean(); assertTrue(b); }
@Test public void testTrueFalseTrue(){ byte val = (byte)0b1010_0000; BitReader reader = new BitReader(new byte[]{val}); assertTrue(reader.readBoolean()); assertFalse(reader.readBoolean()); assertTrue(reader.readBoolean()); }