Java divide BigInteger
Tags: BigInteger BigInteger divide
In this Java core tutorial we learn how to use the java.math.BigInteger.divide() method to divide BigInteger values.
How to divide BigInteger value
To divide BigInteger values we can use the method java.math.BigInteger.divide() which returns the division result of two BigInteger values.
DivideBigIntegerExample.java
import java.math.BigInteger;
public class DivideBigIntegerExample {
public static void main(String... args) {
BigInteger value1 = new BigInteger("9999999999");
BigInteger value2 = new BigInteger("99");
BigInteger result = value1.divide(value2);
System.out.println(value1 + " / " + value2 + " = " + result);
}
}
9999999999 / 99 = 101010101
Happy Coding 😊