VarEncoder { public static byte[] encodeULong(long value) { checkArgument(value >= 0, "Encoded long must be non-negative"); int size = varLongSize(value); byte[] encodedValue = new byte[1 + size]; encodedValue[0] = (byte) size; for (int i = size; i > 0; i--) { encodedValue[i] = (byte) value; value >>>= 8; } return encodedValue; }  static byte[] encodeULong(long value); static long decodeULong(final byte[] encodedValue); static byte[] appendByteArrays(List<byte[]> arrays); static byte[] appendByteArraysWithPrefix(byte prefix, byte[]... arrays);  }
@Test(expected = IllegalArgumentException.class) public void testULongEncFailsWhenNeg() { VarEncoder.encodeULong(-1); }