@Test public void testToLocalAmount() throws Exception { BigDecimal expected1 = new BigDecimal("20999999123.456780000000"); BigDecimal actual1 = Coins.toLocalAmount(testAmounts[0], exchangeRate); assertThat(actual1).isEqualTo(expected1); BigDecimal expected2 = new BigDecimal("123.456780000000"); BigDecimal actual2 = Coins.toLocalAmount(testAmounts[1], exchangeRate); assertThat(actual2).isEqualTo(expected2); BigDecimal expected3 = new BigDecimal("0.000010000000"); BigDecimal actual3 = Coins.toLocalAmount(testAmounts[2], exchangeRate); assertThat(actual3).isEqualTo(expected3); }
public static BigDecimal toLocalAmount(Coin coin, BigDecimal exchangeRate) { Preconditions.checkNotNull(coin, "'coin' must be present"); Preconditions.checkNotNull(exchangeRate, "'exchangeRate' must be present"); BigDecimal bitcoins = BigDecimal.valueOf(coin.longValue()).divide(BTC_COIN, LOCAL_SCALE, RoundingMode.HALF_EVEN); return exchangeRate.multiply(bitcoins); }
Coins { public static BigDecimal toLocalAmount(Coin coin, BigDecimal exchangeRate) { Preconditions.checkNotNull(coin, "'coin' must be present"); Preconditions.checkNotNull(exchangeRate, "'exchangeRate' must be present"); BigDecimal bitcoins = BigDecimal.valueOf(coin.longValue()).divide(BTC_COIN, LOCAL_SCALE, RoundingMode.HALF_EVEN); return exchangeRate.multiply(bitcoins); } }
Coins { public static BigDecimal toLocalAmount(Coin coin, BigDecimal exchangeRate) { Preconditions.checkNotNull(coin, "'coin' must be present"); Preconditions.checkNotNull(exchangeRate, "'exchangeRate' must be present"); BigDecimal bitcoins = BigDecimal.valueOf(coin.longValue()).divide(BTC_COIN, LOCAL_SCALE, RoundingMode.HALF_EVEN); return exchangeRate.multiply(bitcoins); }  }
Coins { public static BigDecimal toLocalAmount(Coin coin, BigDecimal exchangeRate) { Preconditions.checkNotNull(coin, "'coin' must be present"); Preconditions.checkNotNull(exchangeRate, "'exchangeRate' must be present"); BigDecimal bitcoins = BigDecimal.valueOf(coin.longValue()).divide(BTC_COIN, LOCAL_SCALE, RoundingMode.HALF_EVEN); return exchangeRate.multiply(bitcoins); }  static BigDecimal toLocalAmount(Coin coin, BigDecimal exchangeRate); static Coin fromLocalAmount(BigDecimal localAmount, BigDecimal exchangeRate); static Coin fromPlainAmount(BigDecimal plainAmount); static Coin fromPlainAmount(String plainAmount); static Coin fromSymbolicAmount(BigDecimal symbolicAmount, BitcoinSymbol bitcoinSymbol); static BigDecimal toSymbolicAmount(Coin coin, BitcoinSymbol bitcoinSymbol); }
Coins { public static BigDecimal toLocalAmount(Coin coin, BigDecimal exchangeRate) { Preconditions.checkNotNull(coin, "'coin' must be present"); Preconditions.checkNotNull(exchangeRate, "'exchangeRate' must be present"); BigDecimal bitcoins = BigDecimal.valueOf(coin.longValue()).divide(BTC_COIN, LOCAL_SCALE, RoundingMode.HALF_EVEN); return exchangeRate.multiply(bitcoins); }  static BigDecimal toLocalAmount(Coin coin, BigDecimal exchangeRate); static Coin fromLocalAmount(BigDecimal localAmount, BigDecimal exchangeRate); static Coin fromPlainAmount(BigDecimal plainAmount); static Coin fromPlainAmount(String plainAmount); static Coin fromSymbolicAmount(BigDecimal symbolicAmount, BitcoinSymbol bitcoinSymbol); static BigDecimal toSymbolicAmount(Coin coin, BitcoinSymbol bitcoinSymbol); static final BigDecimal BTC_COIN; }