### Question:
EncodingHelper { public static int decodeLittleEndianVarInt(ByteBuffer buffer) { byte b = buffer.get(); int result = b & 0x7f; if ((b & 0x80) > 0) { b = buffer.get(); result |= ((b & 0x7f) << 7); if ((b & 0x80) > 0) { b = buffer.get(); result |= ((b & 0x7f) << 14); if ((b & 0x80) > 0) { b = buffer.get(); result |= ((b & 0x7f) << 21); if ((b & 0x80) > 0) { b = buffer.get(); result |= ((b & 0x07) << 28); } } } } return result; } private  EncodingHelper(); static void encodeLittleEndianFixedWidthLong(long l, byte[] array); static void encodeLittleEndianFixedWidthLong(long value, byte[] array, int off, int len); static long decodeLittleEndianFixedWidthLong(ByteBuffer buffer); static long decodeLittleEndianFixedWidthLong(byte[] bytes, int off, int len); static int encodeLittleEndianVarInt(int n, byte[] buffer); static int decodeLittleEndianVarInt(ByteBuffer buffer); static final int MAX_VARINT_SIZE; }### Answer:
@Test public void testDecodeLittleEndianVarInt() throws Exception { assertEquals(1, EncodingHelper.decodeLittleEndianVarInt(ByteBuffer.wrap(new byte[]{1}))); assertEquals(10, EncodingHelper.decodeLittleEndianVarInt(ByteBuffer.wrap(new byte[]{10}))); assertEquals(127, EncodingHelper.decodeLittleEndianVarInt(ByteBuffer.wrap(new byte[]{127}))); assertEquals(128, EncodingHelper.decodeLittleEndianVarInt(ByteBuffer.wrap(new byte[]{-128, 1}))); assertEquals(10, EncodingHelper.decodeLittleEndianVarInt(ByteBuffer.wrap(new byte[]{10}))); assertEquals(0x7fffffff, EncodingHelper.decodeLittleEndianVarInt(ByteBuffer.wrap(new byte[]{-1, -1, -1, -1, 0x07}))); }