Example usage for java.math BigDecimal multiply

List of usage examples for java.math BigDecimal multiply

Introduction

In this page you can find the example usage for java.math BigDecimal multiply.

Prototype

public BigDecimal multiply(BigDecimal multiplicand) 

Source Link

Document

Returns a BigDecimal whose value is (this × multiplicand), and whose scale is (this.scale() + multiplicand.scale()) .

Usage

From source file:Main.java

public static BigDecimal calculateInterest(BigDecimal amount, BigDecimal rate, long days) {
    return amount.multiply(rate).multiply(new BigDecimal(days / 360.0 / 100.0));
}

From source file:Main.java

private static long moneyAsLong(BigDecimal bd) {
    return bd.multiply(HUNDRED).intValue();
}

From source file:Main.java

public static double mul(String d1, String d2) {
    BigDecimal b1 = new BigDecimal(d1);
    BigDecimal b2 = new BigDecimal(d2);
    return b1.multiply(b2).doubleValue();

}

From source file:Main.java

public static String mul(String v1, String v2) {
    BigDecimal b1 = new BigDecimal(v1);
    BigDecimal b2 = new BigDecimal(v2);
    return b1.multiply(b2).toString();
}

From source file:Main.java

public static double mul(String v1, String v2) {
    BigDecimal b1 = new BigDecimal(v1);
    BigDecimal b2 = new BigDecimal(v2);
    return b1.multiply(b2).doubleValue();
}

From source file:Main.java

public static Integer processCurreny(String value) {
    BigDecimal bd = new BigDecimal(value);
    bd.setScale(2, BigDecimal.ROUND_HALF_UP);
    bd = bd.multiply(new BigDecimal(100));
    return bd.intValue();
}

From source file:Main.java

public static float numMathMul(float d1, float d2) {
    BigDecimal b1 = new BigDecimal(d1);
    BigDecimal b2 = new BigDecimal(d2);
    float res = b1.multiply(b2).setScale(1, BigDecimal.ROUND_HALF_UP).floatValue();
    return res;//  w w w . j av a  2s  .co m
}

From source file:Main.java

public static double mul(double v1, double v2) {
    BigDecimal a = new BigDecimal(v1);
    BigDecimal b = new BigDecimal(v2);
    BigDecimal c = a.multiply(b);
    return c.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
}

From source file:Main.java

public static double mul(String value1, String value2) {
    BigDecimal b1 = new BigDecimal(value1);
    BigDecimal b2 = new BigDecimal(value2);
    return b1.multiply(b2).doubleValue();
}

From source file:com.creditcloud.ump.model.ump.utils.UmpUtils.java

public static String toCents(BigDecimal amountInYuan) {
    return amountInYuan.multiply(HUNDRED).stripTrailingZeros().toPlainString();
}