package org.kodejava.math;
import java.math.BigInteger;
public class BigIntegerOperation {
public static void main(String[] args) {
BigInteger numberA = new BigInteger("98765432123456789");
BigInteger numberB = BigInteger.TEN;
numberA = numberA.add(numberB);
System.out.println("numberA = " + numberA);
numberA = numberA.multiply(numberB);
System.out.println("numberA = " + numberA);
numberA = numberA.subtract(numberB);
System.out.println("numberA = " + numberA);
numberA = numberA.divide(numberB);
System.out.println("numberA = " + numberA);
numberA = numberA.mod(numberB);
System.out.println("numberA = " + numberA);
numberA = numberA.pow(2);
System.out.println("numberA = " + numberA);
numberA = numberA.negate();
System.out.println("numberA = " + numberA);
}
}
Our class result are:
numberA = 98765432123456799
numberA = 987654321234567990
numberA = 987654321234567980
numberA = 98765432123456798
numberA = 8
numberA = 64
numberA = -64
Latest posts by Wayan (see all)
- How do I get number of each day for a certain month in Java? - September 8, 2024
- How do I get operating system process information using ProcessHandle? - July 22, 2024
- How do I sum a BigDecimal property of a list of objects using Java Stream API? - July 22, 2024