Java BigDecimal Calculate calculateProfit(BigDecimal totalAmt, Integer duration, BigDecimal rate)

Here you can find the source of calculateProfit(BigDecimal totalAmt, Integer duration, BigDecimal rate)

Description

calculate Profit

License

Apache License

Declaration

public static BigDecimal calculateProfit(BigDecimal totalAmt, Integer duration, BigDecimal rate) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Calendar;

public class Main {
    public static BigDecimal calculateProfit(BigDecimal totalAmt, Integer duration, BigDecimal rate) {
        Calendar cal = Calendar.getInstance();
        int maxDayNum = cal.getActualMaximum(Calendar.DAY_OF_YEAR);
        return totalAmt.multiply(new BigDecimal(duration)).multiply(rate).divide(new BigDecimal(maxDayNum * 100), 2,
                RoundingMode.CEILING);
    }//from  w  w w.j  av a  2  s  . c  om
}

Related

  1. calculateGainPercentage(BigDecimal gain, BigDecimal totalGains)
  2. calculateLHS(BigDecimal a, Vector Bj, Vector Bj1)
  3. calculateMonthCapital(BigDecimal eachIssueMoney, BigDecimal eachMonthInterest)
  4. calculateMonthInterest(Float interestRate, BigDecimal investmoney)
  5. calculatePercentChange(BigDecimal from, BigDecimal to)
  6. calculateRatioInDecimal(BigDecimal numberA, BigDecimal numberB)
  7. coerce(BigDecimal val, int targetPrecision, int targetScale)
  8. cosh(final BigDecimal dec, final int scale, final RoundingMode mode)
  9. cosine(BigDecimal x)