@Test public void testSignedNegative() throws IOException { BitReader bu = new BitReader(new byte[] {(byte) 160, 0, 0, 0}); int binary = (int) bu.bits2SInt(4); assertEquals(-2, binary); }
public long bits2SInt(int nb) throws IOException { long result = bits2UInt(nb); if (getBit(result, nb)) { result = setBit(result, nb, false); result = ~result & LONG_BITMASK; result = result + 1; } return result; }
BitReader { public long bits2SInt(int nb) throws IOException { long result = bits2UInt(nb); if (getBit(result, nb)) { result = setBit(result, nb, false); result = ~result & LONG_BITMASK; result = result + 1; } return result; } }
BitReader { public long bits2SInt(int nb) throws IOException { long result = bits2UInt(nb); if (getBit(result, nb)) { result = setBit(result, nb, false); result = ~result & LONG_BITMASK; result = result + 1; } return result; } BitReader(byte[] test);  BitReader(RandomAccessFile raf, long startPos); }
BitReader { public long bits2SInt(int nb) throws IOException { long result = bits2UInt(nb); if (getBit(result, nb)) { result = setBit(result, nb, false); result = ~result & LONG_BITMASK; result = result + 1; } return result; } BitReader(byte[] test);  BitReader(RandomAccessFile raf, long startPos); void incrByte(); void setBitOffset(int bitOffset); long getPos(); long bits2UInt(int nb); long bits2SInt(int nb); }
BitReader { public long bits2SInt(int nb) throws IOException { long result = bits2UInt(nb); if (getBit(result, nb)) { result = setBit(result, nb, false); result = ~result & LONG_BITMASK; result = result + 1; } return result; } BitReader(byte[] test);  BitReader(RandomAccessFile raf, long startPos); void incrByte(); void setBitOffset(int bitOffset); long getPos(); long bits2UInt(int nb); long bits2SInt(int nb);  }