Java BigDecimal getConversionUsdBased(final String destinycode, final BigDecimal amount, final BigDecimal usdBasedBaseRate, BigDecimal usdBasedDestinyRate)

Here you can find the source of getConversionUsdBased(final String destinycode, final BigDecimal amount, final BigDecimal usdBasedBaseRate, BigDecimal usdBasedDestinyRate)

Description

get Conversion Usd Based

License

Open Source License

Declaration

public static BigDecimal getConversionUsdBased(final String destinycode, final BigDecimal amount,
            final BigDecimal usdBasedBaseRate, BigDecimal usdBasedDestinyRate) 

Method Source Code


//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);
        }
    }
}

Related

  1. getArcCosineFor(BigDecimal radians)
  2. getAsDouble(BigDecimal value)
  3. getBalance(BigDecimal balance)
  4. getBtcToBuy(BigDecimal ask, BigDecimal bid, BigDecimal fee, BigDecimal scalpAmount)
  5. getByteArrayFromBigDecimalArray(Object value)
  6. getDateFromRank(BigDecimal rank)
  7. getDepositAmount(Boolean isReceipt, BigDecimal amount)
  8. getDigits(BigDecimal value)
  9. getDistance(BigDecimal sourceLatitude, BigDecimal sourceLongitude, BigDecimal destLatitude, BigDecimal destLongitude)