@Test
public void testEncode() throws Exception {

    IntegerLSBCodec codec = new IntegerLSBCodec();
    Assert.assertArrayEquals(new byte[] { (byte) 0xfe }, codec.encode(-1, 7));
    Assert.assertArrayEquals(new byte[] { (byte) 0xfe, (byte) 0xff }, codec.encode(-2, 16));
    // 11111111 00000001 >> ______11 00000001 >> 11________ 00000001 >> 00000001 11________
    Assert.assertArrayEquals(new byte[] { (byte) 0x01, (byte) 0xc0 }, codec.encode(-255, 10));
    Assert.assertArrayEquals(new byte[] { (byte) 0xfc, (byte) 0xff, (byte) 0xff }, codec.encode(-4, 24));
    codec.reset();
}