1. Assign values:
BigInteger a=new BigInteger ("1");
BigInteger b=biginteger.valueof (1);
2. Operation:
①add (); Add large integers
BigInteger a=new BigInteger ("23");
BigInteger b=new BigInteger ("34");
A. Add (b);
②subtract (); Subtraction
③multiply (); Multiply
④divide (); Divide rounding
⑤remainder (); Take surplus
⑥pow (); A.pow (b) =a^b
⑦GCD (); Greatest common divisor
⑧abs (); Absolute
⑨negate (); Take the inverse number
⑩mod (); A.mod (b) =a%b=a.remainder (b);
3.BigInteger Constructors:
Generally used in the following two kinds:
BigInteger (String val);
Converts the specified string to a decimal representation;
BigInteger (String val,int radix);
Converts the string representation of a BigInteger of a specified cardinality to BigInteger
4. Basic constants:
A=biginteger.one 1
B=biginteger.ten 10
C=biginteger.zero 0
5.n.compareto (Biginteger.zero) ==0//equivalent to N==0
6.if (A[i].compareto (n) >=0 &&a[i].compareto (m) <=0)//A[i]>=n && a[i]<=m
1 ImportJava.math.BigInteger;2 ImportJava.util.Scanner;3 4 Public classMain {5 6 Public Static voidMain (string[] args) {7BigInteger sum =NewBigInteger ("1");8Scanner input =NewScanner (system.in);9 while(true)Ten { OneBigInteger num =Input.nextbiginteger (); A if(num equals (Biginteger.zero)) Break; - Elsesum =sum.multiply (num); - } the intCNT = 0; - System.out.println (sum); - while(true ) - { +biginteger[] bis =Sum.divideandremainder (biginteger.ten); - if(bis[1].equals (Biginteger.zero)) + { Acnt++; atsum = bis[0]; - } - Else Break; - - - } in System.out.println (CNT); - to + - } the}
On BigInteger usage in Java