@Test
public void testDecode() throws Exception {

    IntegerLSBCodec codec = new IntegerLSBCodec();
    // 1111111_ >> 11111111
    Assert.assertEquals(-1, codec.decode(new byte[] { (byte) 0xfe }, 7), 0);
    // 11111110 11111111 >> 11111111 11111110
    Assert.assertEquals(-2, codec.decode(new byte[] { (byte) 0xfe, (byte) 0xff }, 16), 0);
    // 00000001 11______ >> 00000001 11000000 >> 11000000 00000001 >> ______11 00000001
    Assert.assertEquals(-255, codec.decode(new byte[] { (byte) 0x01, (byte) 0xcf }, 10), 0);
    Assert.assertEquals(-4, codec.decode(new byte[] { (byte) 0xfc, (byte) 0xff, (byte) 0xff }, 24), 0);
    codec.reset();
}