### Question:
UIntegerLexicoder extends AbstractLexicoder<Integer> { @Override public byte[] encode(Integer i) { int shift = 56; int index; int prefix = i < 0 ? 0xff : 0x00; for (index = 0; index < 4; index++) { if (((i >>> shift) & 0xff) != prefix) break; shift -= 8; } byte[] ret = new byte[5 - index]; ret[0] = (byte) (4 - index); for (index = 1; index < ret.length; index++) { ret[index] = (byte) (i >>> shift); shift -= 8; } if (i < 0) ret[0] = (byte) (8 - ret[0]); return ret; }  @Override byte[] encode(Integer i); @Override Integer decode(byte[] b);  }### Answer:
@Test public void testEncoding() { UIntegerLexicoder uil = new UIntegerLexicoder(); assertEqualsB(uil.encode(0), new byte[] {0x00}); assertEqualsB(uil.encode(0x01), new byte[] {0x01, 0x01}); assertEqualsB(uil.encode(0x0102), new byte[] {0x02, 0x01, 0x02}); assertEqualsB(uil.encode(0x010203), new byte[] {0x03, 0x01, 0x02, 0x03}); assertEqualsB(uil.encode(0x01020304), new byte[] {0x04, 0x01, 0x02, 0x03, 0x04}); assertEqualsB(uil.encode(0xff020304), new byte[] {0x05, 0x02, 0x03, 0x04}); assertEqualsB(uil.encode(0xffff0304), new byte[] {0x06, 0x03, 0x04}); assertEqualsB(uil.encode(0xffffff04), new byte[] {0x07, 0x04}); assertEqualsB(uil.encode(-1), new byte[] {0x08}); }