code: @Override
  	public int readBit() {
  		if (position == size) throw new EndOfBitStreamException();
  		int count = (int) position & 7;
  		if (count == 0) { // need new bits
  			buffer = readByte();
  			if (buffer == -1) throw new EndOfBitStreamException();
  		}
  		position++;
  		// other endian
  		// return (buffer >> count) & 1;
  		return (buffer >> (7 - count)) & 1;
  	}
docs: bit reader methods