Java BigDecimal Multiply mul(BigDecimal v1, BigDecimal v2)

Here you can find the source of mul(BigDecimal v1, BigDecimal v2)

Description

mul

License

LGPL

Declaration

public static BigDecimal mul(BigDecimal v1, BigDecimal v2) 

Method Source Code


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

import java.math.BigDecimal;

public class Main {

    public static BigDecimal mul(BigDecimal v1, BigDecimal v2) {
        if (v1 == null || v2 == null) {
            return new BigDecimal(0);
        }// w  ww.  ja v  a  2 s .c  o  m
        BigDecimal b1 = new BigDecimal(Double.toString(v1.doubleValue()));
        BigDecimal b2 = new BigDecimal(Double.toString(v2.doubleValue()));

        return b1.multiply(b2);
    }

    public static BigDecimal mul(Long v1, BigDecimal v2) {
        if (v1 == null || v2 == null) {
            return new BigDecimal(0);
        }
        BigDecimal b1 = new BigDecimal(Double.toString(v1.doubleValue()));
        BigDecimal b2 = new BigDecimal(Double.toString(v2.doubleValue()));
        return b1.multiply(b2);
    }
}

Related

  1. mul(BigDecimal b1, BigDecimal b2)
  2. mul(BigDecimal d1, BigDecimal d2)
  3. mul(BigDecimal v1, BigDecimal v2)
  4. multiple(BigDecimal dividend, int divisor)
  5. multiply(BigDecimal a, BigDecimal b)
  6. multiply(BigDecimal a, int multiplier)