### Question:
Utils { public static BigInteger toNanoCoins(int coins, int cents) { checkArgument(cents < 100); checkArgument(cents >= 0); checkArgument(coins >= 0); checkArgument(coins < NetworkParameters.MAX_MONEY.divide(Utils.COIN).longValue()); BigInteger bi = BigInteger.valueOf(coins).multiply(COIN); bi = bi.add(BigInteger.valueOf(cents).multiply(CENT)); return bi; }  static BigInteger toNanoCoins(int coins, int cents); static byte[] bigIntegerToBytes(BigInteger b, int numBytes); static BigInteger toNanoCoins(String coins); static void uint32ToByteArrayBE(long val, byte[] out, int offset); static void uint32ToByteArrayLE(long val, byte[] out, int offset); static void uint64ToByteArrayLE(long val, byte[] out, int offset); static void uint32ToByteStreamLE(long val, OutputStream stream); static void int64ToByteStreamLE(long val, OutputStream stream); static void uint64ToByteStreamLE(BigInteger val, OutputStream stream); static byte[] doubleDigest(byte[] input); static byte[] doubleDigest(byte[] input, int offset, int length); static byte[] scryptDigest(byte[] input); static byte[] singleDigest(byte[] input, int offset, int length); static byte[] doubleDigestTwoBuffers(byte[] input1, int offset1, int length1,
                                                byte[] input2, int offset2, int length2); static boolean isLessThanUnsigned(long n1, long n2); static String bytesToHexString(byte[] bytes); static byte[] reverseBytes(byte[] bytes); static byte[] reverseDwordBytes(byte[] bytes, int trimLength); static long readUint32(byte[] bytes, int offset); static long readInt64(byte[] bytes, int offset); static long readUint32BE(byte[] bytes, int offset); static int readUint16BE(byte[] bytes, int offset); static byte[] sha256hash160(byte[] input); static String bitcoinValueToFriendlyString(BigInteger value); static String bitcoinValueToPlainString(BigInteger value); static BigInteger decodeMPI(byte[] mpi, boolean hasLength); static byte[] encodeMPI(BigInteger value, boolean includeLength); static BigInteger decodeCompactBits(long compact); static Date rollMockClock(int seconds); static Date rollMockClockMillis(long millis); static void setMockClock(); static void setMockClock(long mockClock); static Date now(); static long currentTimeMillis(); static long currentTimeSeconds(); static byte[] copyOf(byte[] in, int length); static byte[] appendByte(byte[] bytes, byte b); static byte[] parseAsHexOrBase58(String data); static boolean isWindows(); static byte[] formatMessageForSigning(String message); static boolean checkBitLE(byte[] data, int index); static void setBitLE(byte[] data, int index); static void sleep(long millis); static void setMockSleep(boolean isEnable); static void passMockSleep(); static void finishMockSleep(); static final BigInteger NEGATIVE_ONE; static final String BITCOIN_SIGNED_MESSAGE_HEADER; static final byte[] BITCOIN_SIGNED_MESSAGE_HEADER_BYTES; static final BigInteger COIN; static final BigInteger CENT; static volatile Date mockTime; }### Answer:
@Test public void testToNanoCoins() { assertEquals(CENT, toNanoCoins("0.01")); assertEquals(CENT, toNanoCoins("1E-2")); assertEquals(COIN.add(Utils.CENT), toNanoCoins("1.01")); try { toNanoCoins("2E-20"); org.junit.Assert.fail("should not have accepted fractional nanocoins"); } catch (ArithmeticException e) { } assertEquals(CENT, toNanoCoins(0, 1)); try { toNanoCoins(1, -1); fail(); } catch (IllegalArgumentException e) {} try { toNanoCoins(-1, 0); fail(); } catch (IllegalArgumentException e) {} try { toNanoCoins("-1"); fail(); } catch (ArithmeticException e) {} }