### Question:
BitReader { public byte readByte(){ if(bits % 8 == 0){ int i = bits / 8; bits += 8; return data[i]; } byte tmp = 0; for(int j=0; j<8; j++){ tmp = (byte) (tmp << 1); boolean k = readBoolean(); if(k){ tmp |= 1; } } return tmp; } BitReader(byte[] data); byte readByte(); boolean readBoolean(); int readInt(); int readInt(int nbits); char readChar();  }### Answer:
@Test public void testByte(){ byte val = 5; BitReader reader = new BitReader(new byte[]{val}); byte res = reader.readByte(); assertEquals(val, res); }
@Test public void testNegativeByte(){ byte val = -125; BitReader reader = new BitReader(new byte[]{val}); byte res = reader.readByte(); assertEquals(val, res); }