@Test public void testBoolean(){ byte val = (byte)0b1000_0000; BitReader reader = new BitReader(new byte[]{val}); boolean b = reader.readBoolean(); assertTrue(b); }
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 { 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 { 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); }
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(); }
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();  }