### Question:
BitReader { public int readInt(){ int x; byte a = readByte(); x = a & 0xFF; byte b = readByte(); x = x << 8; x |= (b & 0xFF); byte c = readByte(); x = x << 8; x |= (c & 0xFF); byte d = readByte(); x = x << 8; x |= (d & 0xFF); return x; } BitReader(byte[] data); byte readByte(); boolean readBoolean(); int readInt(); int readInt(int nbits); char readChar();  }### Answer:
@Test public void testSmallInt(){ int val = 5; BitWriter writer = new BitWriter(); writer.write(val); BitReader reader = new BitReader(writer.extract()); int res = reader.readInt(); assertEquals(val, res); }
@Test public void testIntWithNegativeBytes(){ int val = 0b1000_0000_1000_0000; BitWriter writer = new BitWriter(); writer.write(val); BitReader reader = new BitReader(writer.extract()); int res = reader.readInt(); assertEquals(val, res); }