The basic integer and float precision does not meet the requirements, then you can use the two classes in Java.math: BigInteger and BigDecimal.
BigInteger and BigDecimal Introduction:
These two classes can handle numeric values that contain sequences of any length.
The BigInteger class implements an integer calculation of arbitrary precision. BigDecimal realizes the calculation of floating-point number with arbitrary precision.
Use the static ValueOf method to convert a normal value to a large value
BigInteger a = BigInteger.valueOf(100);
Use:
BIgInteger C = a.add (b);(C = a+b;)
Biginterger d = c.multiply (B.add (biginteger.valueof (2)));(d = c* (b+2));
BigInteger's API Description:
Add (BigInteger a)//Plus
Subtract (BigInteger a)//subtraction
Multiply (BigInteger a)//multiplication
Divide (BigInteger a)//division
MoD (BigInteger a)//Find redundancy
CompareTo (BigInteger a)//equals return 0. Less than negative, greater than positive
ValueOf (long x)//large integer that returns x
Bigdecamal's API Description:
Add (BigDecimal a)//Plus
Subtract (BigDecimal a)//subtraction
Multiply (BigDecimal a)//multiplication
Divide (BigDecimal a)//division
CompareTo (BigDecimal a)//rules with Bigineger
ValueOf (long x)
Welcome to the group: public number It face questions summary discussion group
If the scan does not go in, add me (rdst6029930) pull you. Sweep my QR code plus me
You are welcome to pay attention to the "It question summary" subscription number. Every day to push the classic face test and interview tips, are dry! The QR code of the subscription number is as follows:
"44" Java Large numerical analysis