### Question:
Numeric { public static BigInteger decodeQuantity(String value) { if (!isValidHexQuantity(value)) { throw new MessageDecodingException("Value must be in format 0x[1-9]+[0-9]* or 0x0"); } try { return new BigInteger(value.substring(2), 16); } catch (NumberFormatException e) { throw new MessageDecodingException("Negative ", e); } } private  Numeric(); static String encodeQuantity(BigInteger value); static BigInteger decodeQuantity(String value); static String cleanHexPrefix(String input); static String prependHexPrefix(String input); static boolean containsHexPrefix(String input); static BigInteger toBigInt(byte[] value, int offset, int length); static BigInteger toBigInt(byte[] value); static BigInteger toBigInt(String hexValue); static BigInteger toBigIntNoPrefix(String hexValue); static String toHexStringWithPrefix(BigInteger value); static String toHexStringNoPrefix(BigInteger value); static String toHexStringNoPrefix(byte[] input); static String toHexStringWithPrefixZeroPadded(BigInteger value, int size); static String toHexStringNoPrefixZeroPadded(BigInteger value, int size); static byte[] toBytesPadded(BigInteger value, int length); static byte[] hexStringToByteArray(String input); static String toHexString(byte[] input, int offset, int length, boolean withPrefix); static String toHexString(byte[] input); static byte asByte(int m, int n); static boolean isIntegerValue(BigDecimal value);  }### Answer:
@Test public void testQuantityDecode() { assertThat(Numeric.decodeQuantity("0x0"), equalTo(BigInteger.valueOf(0L))); assertThat(Numeric.decodeQuantity("0x400"), equalTo(BigInteger.valueOf((1024L)))); assertThat(Numeric.decodeQuantity("0x0"), equalTo(BigInteger.valueOf((0L)))); assertThat(Numeric.decodeQuantity( "0x7fffffffffffffff"), equalTo(BigInteger.valueOf((Long.MAX_VALUE)))); assertThat(Numeric.decodeQuantity("0x99dc848b94efc27edfad28def049810f"), equalTo(new BigInteger("204516877000845695339750056077105398031"))); }
@Test public void testQuantityDecodeLeadingZero() { assertThat(Numeric.decodeQuantity("0x0400"), equalTo(BigInteger.valueOf(1024L))); assertThat(Numeric.decodeQuantity("0x001"), equalTo(BigInteger.valueOf(1L))); }
@Ignore @Test(expected = MessageDecodingException.class) public void testQuantityDecodeLeadingZeroException() { Numeric.decodeQuantity("0x0400"); }
@Test(expected = MessageDecodingException.class) public void testQuantityDecodeMissingPrefix() { Numeric.decodeQuantity("ff"); }
@Test(expected = MessageDecodingException.class) public void testQuantityDecodeMissingValue() { Numeric.decodeQuantity("0x"); }