Java Large number Bininteger

Source: Internet
Author: User

When we meet long does not need to consider this bininteger, because this is as long as you have enough memory, you can enter a large number, with this processing of high-precision problems, it is very easy, for me this just learn Java new, long insight, really more convenient than C

BigInteger arbitrarily large integers, in principle, as long as your computer's memory is large enough to have unlimited digits

Force type conversion int---BigInteger

Biginteger.valueof (k);

VALUEOF: Assigning an initial value

add:+ A.add (b);

subtract:-

multiply:*

divide:/

Remainder:this% val

Divideandremainder:a[0]=this/val; A[1]=this% val

Pow:a.pow (b) =a^b

Gcd,abs: Number of conventions, absolute value

Negate: Take negative numbers

Signum: Symbolic functions

Mod:a.mod (b) =a%b;

ABS ()//returns the BigInteger whose value is the absolute of this biginteger.
Add (BigInteger val)//returns the BigInteger whose value is (This+val).
Subtract (BigInteger val)//returns the BigInteger whose value is (This-val).
Multiply (BigInteger val)//returns the BigInteger whose value is (This*val).
Divide (BigInteger val)//returns the BigInteger whose value is (This/val).
Remainder (BigInteger val)//returns the BigInteger whose value is (This%val).
CompareTo (BigInteger val)//compares this BigInteger with the specified BigInteger. The return value of 1, 0,-1 represents greater than, equal to, or less than
POW (int exponent)//returns the exponent power of the current large number.
ToString ()//returns the decimal string representation of this BigInteger.
toString (int radix)//Returns a string representation of the given cardinality (radix) of this BigInteger.

Resource reference: https://www.cnblogs.com/jin-nuo/p/5313205.html

Java Large number Bininteger

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.