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 Integer change2int(String price) {
    BigDecimal decimal = new BigDecimal(price);
    BigDecimal decimal1 = new BigDecimal(100);
    return decimal.multiply(decimal1).intValue();
}

From source file:Main.java

public static String formatPercent(BigDecimal number) {
    String result = "0";

    if (number != null) {
        number = number.multiply(new BigDecimal("100"));
        DecimalFormat formatter = new DecimalFormat();
        formatter.setMaximumFractionDigits(2);
    }//from  ww w .  j av  a2 s.co m

    return result;
}

From source file:Main.java

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

From source file:Main.java

public static String change2String(String price) {
    BigDecimal decimal = new BigDecimal(price);
    BigDecimal decimal1 = new BigDecimal(100);
    return decimal.multiply(decimal1).toString();
}

From source file:ymanv.forex.provider.AProvider.java

protected static BigDecimal divide(BigDecimal dividend, BigDecimal divisor) {
    return dividend.multiply(PRECISION_QUANTITY).divide(divisor, RoundingMode.HALF_UP)
            .divide(PRECISION_QUANTITY);
}

From source file:Main.java

public static BigDecimal mulBigDecimal(double v1, double v2) {
    BigDecimal b1 = new BigDecimal(Double.toString(v1));
    BigDecimal b2 = new BigDecimal(Double.toString(v2));
    return b1.multiply(b2);
}

From source file:Main.java

public static double multiply(double d1, double d2) {
    BigDecimal b1 = new BigDecimal(Double.toString(d1));
    BigDecimal b2 = new BigDecimal(Double.toString(d2));
    return b1.multiply(b2).doubleValue();
}

From source file:Main.java

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

}

From source file:Main.java

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

From source file:be.error.rpi.ebus.Support.java

public static String encodeDATA2c(BigDecimal data) {
    return new String(encodeHex(
            encodeInt((short) (data.multiply(new BigDecimal(16)).setScale(0, ROUND_FLOOR).floatValue()))));
}