The
java.math.BigInteger.multiply(BigInteger val) is used to calculate the multiplication of two BigIntegers. As
BigInteger class internally uses an array of integers for processing, the operation on an object of BigInteger are not as fast as on primitives.
Syntax:
public BigInteger multiply(BigInteger val)
Parameters: This method accepts a parameter
val which is the value to be multiplied to this BigInteger.
Return value: This method returns a BigInteger which holds multiplication (this * val).
Below programs is used to illustrate the multiply() method of BigInteger.
Example 1:
Output:
The multiplication of
12345678901234567654632498739473
and
12345678901234561247612748612746
is
152415787532388282591353462245536419067346861445890674421122858
Example 2: