### Question:
Varint { public static long readAsLong(final ByteBuf bb) { return read(bb); }  static long random(); static long random(final int min); static long readAsLong(final ByteBuf bb); static long readAsLong(final byte[] b); static int readAsInt(final ByteBuf bb); static int readAsInt(final byte[] b); static byte readAsByte(final ByteBuf bb); static void write(final long value, final ByteBuf bb); static byte[] write(final long value); static final long MAX; }### Answer:
@Test public void read2() { final ByteBuf bb = Unpooled.copiedBuffer(Hex.dehex("7b bd")); final long vi = Varint.readAsLong(bb); assertEquals(15293, vi); assertFalse(bb.isReadable()); }
@Test public void read2Bytes() { final long vi = Varint.readAsLong(Hex.dehex("7b bd")); assertEquals(15293, vi); }
@Test public void read1() { final ByteBuf bb = Unpooled.copiedBuffer(Hex.dehex("25")); final long vi = Varint.readAsLong(bb); assertEquals(37, vi); assertFalse(bb.isReadable()); }
@Test public void read1Bytes() { final long vi = Varint.readAsLong(Hex.dehex("25")); assertEquals(37, vi); }
@Test public void read8() { final ByteBuf bb = Unpooled.copiedBuffer(Hex.dehex("c2 19 7c 5e ff 14 e8 8c")); final long vi = Varint.readAsLong(bb); assertEquals(151288809941952652L, vi); assertFalse(bb.isReadable()); }
@Test public void read8Bytes() { final long vi = Varint.readAsLong(Hex.dehex("c2 19 7c 5e ff 14 e8 8c")); assertEquals(151288809941952652L, vi); }
@Test public void read4() { final ByteBuf bb = Unpooled.copiedBuffer(Hex.dehex("9d 7f 3e 7d")); final long vi = Varint.readAsLong(bb); assertEquals(494878333, vi); assertFalse(bb.isReadable()); }
@Test public void read4Bytes() { final long vi = Varint.readAsLong(Hex.dehex("9d 7f 3e 7d")); assertEquals(494878333, vi); }