Java BigDecimal Multiply multiply(BigDecimal num1, BigDecimal num2)

Here you can find the source of multiply(BigDecimal num1, BigDecimal num2)

Description

multiply

License

Apache License

Declaration

public static BigDecimal multiply(BigDecimal num1, BigDecimal num2) 

Method Source Code


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

import java.math.BigDecimal;

public class Main {
    public static final int STANDARD_ROUND_HALF = BigDecimal.ROUND_HALF_UP;
    public static final int STANDARD_SCALE = 2;
    /**//from  w w w . ja  va  2 s .  co  m
     * 0
     **/
    public static final BigDecimal ZERO = new BigDecimal("0");

    public static BigDecimal multiply(BigDecimal num1, BigDecimal num2) {
        if (null == num1 || null == num2) {
            return ZERO;
        }
        BigDecimal temp = num1.multiply(num2);
        return temp.setScale(STANDARD_SCALE, STANDARD_ROUND_HALF);
    }
}

Related

  1. multiply(BigDecimal amount, BigDecimal multiplicand, int scale)
  2. multiply(BigDecimal aValue1, BigDecimal aValue2)
  3. multiply(BigDecimal bigDecimal, BigDecimal bigDecimal2)
  4. multiply(BigDecimal left, BigDecimal right)
  5. multiply(BigDecimal multiplier1, BigDecimal multiplier2, int scale)
  6. multiply(BigDecimal num1, BigDecimal num2)
  7. multiply(BigDecimal number1, BigDecimal number2, int decimalPlaces)
  8. multiply(BigDecimal one, BigDecimal another)
  9. multiply(BigDecimal op1, int op2)