buf.clear();
ByteBufUtils.writeVarInt(buf, 2097152, 4);
assertArrayEquals("16384 as byte[] is [-128, -128, 1]", new byte[] { -128, -128, -128, 1, 0 }, buf.array());
buf.clear();
ByteBufUtils.writeVarInt(buf, 268435455, 4);
assertArrayEquals("268435455 as byte[] is [-1, -1, -1, 127]", new byte[] { -1, -1, -1, 127, 0 }, buf.array());
buf.clear();
ByteBufUtils.writeVarInt(buf, 268435456, 5);