The large number of Java is still very useful!
Basic join:
Import Java.math.BigInteger;
Import Jave.math.BigDecimal;
are large numbers and large floating point numbers, respectively.
First read-in can be used:
Scanner input = new Scanner (system.in);
BigInteger a = new Input.nextbiginteger ();
It's easy to read like this.
And, of course, create it yourself:
BigInteger a = new BigInteger ("1");
int b=1;
BigInteger C = biginteger.valueof (b);
BigInteger d = biginteger.one;
BigInteger e = C.add (a);
This type of definition, mainly by the use of a string can be defined, and then you can use the valueof (value) of the function, of course, the parentheses need a long type or can be directly converted to a long value, can be defined with a large number of constants, you can use other large numbers or other large number of return value to a large number of functions.
The Java large number also has this kind of constant:
Biginteger.one;
Biginteger.ten;
Biginteger.zero;
Then there is the important Java large number of operations, the basic operations are relatively simple:
A.add (b); // +
A.subtract (b); // -
A.multiply (b); // *
A.divide (b); // /
A.remainder (b); or a.mod (b); // %
A.pow (b); B Power of a
A.abs (); Abs
A.negate (); * (-1)
A.GCD (b); gcd
A.max (b); A.min (b); Max;min;
A.compareto (b); A>b return 1; A<b return-1; a==b return 0;
Java Large number