Here you can find the source of getConversionUsdBased(final String destinycode, final BigDecimal amount, final BigDecimal usdBasedBaseRate, BigDecimal usdBasedDestinyRate)
public static BigDecimal getConversionUsdBased(final String destinycode, final BigDecimal amount, final BigDecimal usdBasedBaseRate, BigDecimal usdBasedDestinyRate)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; import java.math.RoundingMode; public class Main { public static BigDecimal getConversionUsdBased(final String destinycode, final BigDecimal amount, final BigDecimal usdBasedBaseRate, BigDecimal usdBasedDestinyRate) { if (destinycode.equals("USD")) { return amount.multiply(usdBasedDestinyRate); } else {// www . j av a 2 s . c om BigDecimal inverted = BigDecimal.ONE.divide(usdBasedBaseRate, 2, RoundingMode.HALF_UP); BigDecimal baseRatio = usdBasedDestinyRate.multiply(inverted); return amount.multiply(baseRatio); } } }