Java BigDecimal Divide divide(BigDecimal num1, BigDecimal num2, int scale, int mode)

Here you can find the source of divide(BigDecimal num1, BigDecimal num2, int scale, int mode)

Description

divide

License

Apache License

Declaration

public static BigDecimal divide(BigDecimal num1, BigDecimal num2, int scale, int mode) 

Method Source Code


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

import java.math.BigDecimal;

public class Main {

    public static BigDecimal divide(BigDecimal num1, BigDecimal num2, int scale, int mode) {
        if (null == num1) {
            num1 = BigDecimal.ZERO;
        }/* ww  w .j a v  a2 s.co m*/
        if (num2 == null) {
            return null;
        }
        return num1.divide(num2, scale, mode);
    }

    public static BigDecimal divide(BigDecimal num1, BigDecimal num2) {
        return divide(num1, num2, 0, BigDecimal.ROUND_HALF_UP);
    }
}

Related

  1. divide(BigDecimal bd1, BigDecimal bd2)
  2. divide(BigDecimal dividend, BigDecimal divisor)
  3. divide(BigDecimal dividend, BigDecimal divisor)
  4. divide(BigDecimal dividend, BigDecimal divisor, int scale)
  5. divide(BigDecimal left, BigDecimal right)
  6. divide(BigDecimal num1, BigDecimal num2, int scale, int roundingMode)
  7. divide(BigDecimal number1, BigDecimal number2, int decimalPlaces)
  8. divide(BigDecimal numerator, BigDecimal denominator)
  9. divide(BigDecimal one, BigDecimal another)