List of utility methods to do BigDecimal Divide
BigDecimal | divide(BigDecimal dividend, BigDecimal divisor) Divides the given dividend by the divisor. return divide(dividend, divisor, (RoundingMode) null);
|
BigDecimal | divide(BigDecimal dividend, BigDecimal divisor, int scale) Divides two decimals and applies the given scale and a ROUND_HALF_UP. BigDecimal result = BigDecimal.ZERO; if (dividend != null && divisor != null && !divisor.equals(BigDecimal.ZERO)) { result = dividend.divide(divisor, scale, BigDecimal.ROUND_HALF_UP); return result; |
BigDecimal | divide(BigDecimal left, BigDecimal right) divide try { return left.divide(right, BigDecimal.ROUND_UNNECESSARY); } catch (ArithmeticException ex) { return left.divide(right, MathContext.DECIMAL128); |
BigDecimal | divide(BigDecimal num1, BigDecimal num2, int scale, int mode) divide if (null == num1) { num1 = BigDecimal.ZERO; if (num2 == null) { return null; return num1.divide(num2, scale, mode); |
BigDecimal | divide(BigDecimal num1, BigDecimal num2, int scale, int roundingMode) divide if (null == num1 || null == num2) { return ZERO; if (num2.compareTo(ZERO) == 0) { return ZERO; return num1.divide(num2, STANDARD_SCALE, STANDARD_ROUND_HALF); |
BigDecimal | divide(BigDecimal number1, BigDecimal number2, int decimalPlaces) divide return number1.divide(number2, mathContext).setScale(decimalPlaces, roundingMode);
|
BigDecimal | divide(BigDecimal numerator, BigDecimal denominator) divide return numerator.divide(denominator, context);
|
BigDecimal | divide(BigDecimal one, BigDecimal another) divide return one.divide(another, _SCALE);
|
BigDecimal | divide(BigDecimal op1, int op2, int precision) divide MathContext roundVal = new MathContext(precision, RoundingMode.HALF_UP); return op1.divide(new BigDecimal(op2)).round(roundVal); |
BigDecimal | divide(BigDecimal v1, BigDecimal v2) divide return divide(v1, v2, 2, BigDecimal.ROUND_HALF_UP);
|