ImportJava.math.BigDecimal;ImportJava.math.BigInteger;ImportJava.util.*; Public classMain { Public Static voidMain (string[] args) {Scanner cin=NewScanner (system.in); BigInteger NUM1=Cin.nextbiginteger (); BigInteger num2=Cin.nextbiginteger (); System.out.println (Num1.add (num2)); System.out.println (Num1.subtract (num2)); System.out.println (Num1.multiply (num2)); System.out.println (Num1.divide (num2)); System.out.println (Num1.mod (num2)); System.out.println (NUM1.GCD (num2)); System.out.println (Num1.abs ()); System.out.println (Num1.negate ()); System.out.println (Num1.max (num2)); System.out.println (Num1.min (num2)); System.out.println (Num1.equals (num2)); BigDecimal num3=Cin.nextbigdecimal (); BigDecimal num4=Cin.nextbigdecimal (); System.out.println (Num3.add (NUM4)); System.out.println (Num3.subtract (NUM4)); System.out.println (Num3.multiply (NUM4)); System.out.println (Num3.divide (NUM4,10, Bigdecimal.round_half_down)); System.out.println (Num3.abs ()); System.out.println (Num3.negate ()); System.out.println (Num3.max (NUM4)); System.out.println (Num3.min (NUM4)); System.out.println (Num3.equals (NUM4)); System.out.println (Num3.compareto (NUM4)); }}
Java large number (integer + floating point) basic functions