Java multiply BigInteger

In this Java core tutorial we learn how to use the java.math.BigInteger.multiply() method to get the multiplication result of two BigInteger values.

How to multiply BigInteger values

In the Java program below we show you how to use the java.math.BigInteger.multiply() method to multiply two BigInteger objects.

MultiplyBigIntegerExample.java

import java.math.BigInteger;

public class MultiplyBigIntegerExample {
    public static void main(String... args) {
        BigInteger value1 = new BigInteger("123456789");
        BigInteger value2 = new BigInteger("987654321");

        BigInteger result = value1.multiply(value2);

        System.out.println(value1 + " * " + value2 + " = " + result);
    }
}
The output is:
123456789 * 987654321 = 121932631112635269

Happy Coding 😊