Method divides this.object value by the value of object passed.
Method return type is an bigdecimal array of length two(2). This array contains the method generated results.
At array index zero(array) method generated first result, 'quotient' is located & at array index one(array)
method generated second result, 'remainder' is located.
The first result 'quotient' will always possess integer format. This means method will only generate the integer part, i.e. the portion of 'quotient' before decimal. Method will generate the remainder also as the second(array) element of bigdecimal array.
Method throws Arithmetic Exception when the divisor value is equal to zero.
Note : Using context settings makes no effect in the generating results as methods neglects decimal part of the answer, thus no decimal part therefore no rounding behavior required hence no context settings required.
Syntax for using the method:
public BigDecimal divideAndRemainder(BigDecimal divisor, MathContext mc)
bigdecimal_objectName = dividendName.divideAndRemainder(divisor, mc)
Ask Questions? Discuss: Java BigDecimal divideAndRemainder method example
Post your Comment
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.