### Question:
BitcoinUtils { public static BigInteger convertUsdToSatoshi(BigDecimal usd, BigDecimal USDperBTC) { try { BigDecimal coins = usd.divide(USDperBTC, MathContext.DECIMAL128); return BitcoinUnitConverter.convert(coins, BitcoinUnit.COIN, BitcoinUnit.SATOSHI) .toBigInteger(); } catch (BitcoinUnitConversionNotImplementedException e) { throw new RuntimeException(e); } }  static BigDecimal convertSatoshiToUsd(BigInteger satoshi, BigDecimal USDperBTC); static BigInteger convertUsdToSatoshi(BigDecimal usd, BigDecimal USDperBTC);  }### Answer:
@Test public void testUsdToSatoshiConversion() { BigDecimal usdPerBtc = new BigDecimal("6010"); BigDecimal usd = new BigDecimal("1"); BigInteger satoshi = BitcoinUtils.convertUsdToSatoshi(usd, usdPerBtc); assertEquals(0, satoshi.compareTo(new BigInteger("16638"))); usd = new BigDecimal(1_000_000_000); satoshi = BitcoinUtils.convertUsdToSatoshi(usd, usdPerBtc); assertEquals(0, satoshi.compareTo(new BigInteger("16638935108153"))); usd = new BigDecimal("0.0001"); satoshi = BitcoinUtils.convertUsdToSatoshi(usd, usdPerBtc); assertEquals(0, satoshi.compareTo(BigInteger.ONE)); usd = new BigDecimal("0.00001"); satoshi = BitcoinUtils.convertUsdToSatoshi(usd, usdPerBtc); assertEquals(0, satoshi.compareTo(BigInteger.ZERO)); }