Java.math.BigDecimal Class Java.math.BigDecimal.multiply() Method - Java.math Package

What is Java math BigDecimal multiply() Method?

Description

The java.math.BigDecimal.multiply(BigDecimal multiplicand, MathContext mc) returns a BigDecimal whose price is (this × multiplicand), with rounding in line with the context settings.

Declaration

Following is the declaration for java.math.BigDecimal.multiply() technique.

Parameters

  • Multiplicand − Value to be multiplied by this BigDecimal.
  • Mc − The context to use.

Return Value

This technique returns a BigDecimal whose value this * multiplicand, rounded as necessary.

Exception

Arithmetic Exception − If the result is inexact but the rounding mode is UNNECESSARY.

Example

The following example shows the usage of math.BigDecimal.multiply()technique.

Let us compile and run the above program, this will produce the following result −

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Java.math Package Topics