Java BigDecimal multiply() method

20 Mar 2025 | 2 min read

The multiply() method of java BigDecimal class is used to obtain a BigDecimal whose value is (this  multiplicand), and whose scale is (this.scale() + multiplicand.scale()) with rounding according to the context settings.

Syntax:

Parameter:

multiplicand: value to be multiplied by this BigDecimal.

mc: the context to use.

Exception:

ArithmeticException- if the result is inexact but the rounding mode is UNNECESSARY, then it throws exception :

Returns:

It returns this*multiplicand, rounded as necessary.

Example 1

Output:

 Multiplication of 34.203 and 44.25 is =1513.48275 

Example 2

Output:

 Multiplication of -67 and 25 is = -1675 

Example 3

Output:

 Multiplication of -120 and -35 is = 4200 
 
Next TopicJava BigDecimal