Java BigDecimal Multiply multiply(final BigDecimal val1, final BigDecimal val2)

Here you can find the source of multiply(final BigDecimal val1, final BigDecimal val2)

Description

multiply

License

Open Source License

Declaration

public static final BigDecimal multiply(final BigDecimal val1, final BigDecimal val2) 

Method Source Code


//package com.java2s;
// ProjectForge is dual-licensed.

import java.math.BigDecimal;
import java.math.RoundingMode;

public class Main {
    public static final BigDecimal multiply(final BigDecimal val1, final BigDecimal val2) {
        if (val1 == null) {
            if (val2 == null) {
                return BigDecimal.ZERO;
            } else {
                return val2;
            }/*from   w w  w  .  j a va2  s.  c om*/
        } else if (val2 == null) {
            return val1;
        } else {
            return val1.multiply(val2).setScale(2, RoundingMode.HALF_UP);
        }
    }
}

Related

  1. multiply(BigDecimal op1, int op2)
  2. multiply(BigDecimal toBeMultiplied, int multiplyBy)
  3. multiply(BigDecimal v1, BigDecimal v2)
  4. multiply(BigDecimal value, Integer multiplier)
  5. multiply(BigDecimal... operands)
  6. multiply(final BigDecimal value, final BigDecimal multiplicand)
  7. multiplyBy(BigDecimal multiplicand, BigDecimal multiplier)
  8. multiplyFactor(BigDecimal val, float factor)
  9. multiplyMoeda(BigDecimal val1, BigDecimal val2)