@Test public void testFromSymbolicAmount_Satoshi() throws Exception { BitcoinSymbol bitcoinSymbol = BitcoinSymbol.SATOSHI; BigDecimal localAmount1 = new BigDecimal("2099999912345678"); Coin expected1 = testAmounts[0]; Coin actual1 = Coins.fromSymbolicAmount(localAmount1, bitcoinSymbol); assertThat(actual1).isEqualTo(expected1); BigDecimal localAmount2 = new BigDecimal("12345678"); Coin expected2 = testAmounts[1]; Coin actual2 = Coins.fromSymbolicAmount(localAmount2, bitcoinSymbol); assertThat(actual2).isEqualTo(expected2); BigDecimal localAmount3 = new BigDecimal("1"); Coin expected3 = testAmounts[2]; Coin actual3 = Coins.fromSymbolicAmount(localAmount3, bitcoinSymbol); assertThat(actual3).isEqualTo(expected3); }
public static Coin fromSymbolicAmount(BigDecimal symbolicAmount, BitcoinSymbol bitcoinSymbol) { Preconditions.checkNotNull(symbolicAmount, "'symbolicAmount' must be present"); BigDecimal plainAmount = symbolicAmount .setScale(BITCOIN_SCALE) .divide(bitcoinSymbol.multiplier(), BITCOIN_SCALE, RoundingMode.HALF_EVEN); return fromPlainAmount(plainAmount); }
Coins { public static Coin fromSymbolicAmount(BigDecimal symbolicAmount, BitcoinSymbol bitcoinSymbol) { Preconditions.checkNotNull(symbolicAmount, "'symbolicAmount' must be present"); BigDecimal plainAmount = symbolicAmount .setScale(BITCOIN_SCALE) .divide(bitcoinSymbol.multiplier(), BITCOIN_SCALE, RoundingMode.HALF_EVEN); return fromPlainAmount(plainAmount); } }
Coins { public static Coin fromSymbolicAmount(BigDecimal symbolicAmount, BitcoinSymbol bitcoinSymbol) { Preconditions.checkNotNull(symbolicAmount, "'symbolicAmount' must be present"); BigDecimal plainAmount = symbolicAmount .setScale(BITCOIN_SCALE) .divide(bitcoinSymbol.multiplier(), BITCOIN_SCALE, RoundingMode.HALF_EVEN); return fromPlainAmount(plainAmount); }  }
Coins { public static Coin fromSymbolicAmount(BigDecimal symbolicAmount, BitcoinSymbol bitcoinSymbol) { Preconditions.checkNotNull(symbolicAmount, "'symbolicAmount' must be present"); BigDecimal plainAmount = symbolicAmount .setScale(BITCOIN_SCALE) .divide(bitcoinSymbol.multiplier(), BITCOIN_SCALE, RoundingMode.HALF_EVEN); return fromPlainAmount(plainAmount); }  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 Coin fromSymbolicAmount(BigDecimal symbolicAmount, BitcoinSymbol bitcoinSymbol) { Preconditions.checkNotNull(symbolicAmount, "'symbolicAmount' must be present"); BigDecimal plainAmount = symbolicAmount .setScale(BITCOIN_SCALE) .divide(bitcoinSymbol.multiplier(), BITCOIN_SCALE, RoundingMode.HALF_EVEN); return fromPlainAmount(plainAmount); }  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; }