Java BigDecimal multiply() method

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

Test it Now

Output:

Multiplication of 34.203 and 44.25  is  =1513.48275

Example 2

Test it Now

Output:

Multiplication of -67 and 25  is  = -1675

Example 3

Test it Now

Output:

Multiplication of -120 and -35  is  = 4200

Next TopicJava BigDecimal




Latest Courses