Java basic Knowledge Strengthening the use of BigInteger subtraction method of 88:biginteger class

Source: Internet
Author: User

1. Use of the BigInteger subtraction method

1  Public BigInteger Add (BigInteger val): Add 2  Public BigInteger Subtract (BigInteger val): Minus 3  Public BigInteger Multiply (BigInteger val): Multiply 4  Public BigInteger Divide (BigInteger val): except 5  Public Business Array of remainder

2. code example:

1  Packagecn.itcast_02;2 3 ImportJava.math.BigInteger;4 5 /*6 * Public BigInteger Add (BigInteger val): Plus7 * Public BigInteger Subtract (BigInteger val): Minus8 * Public BigInteger Multiply (BigInteger val): Multiply9 * Public BigInteger Divide (BigInteger val): exceptTen * Public biginteger[] Divideandremainder (BigInteger val): Returns an array of quotient and remainder One  */ A  Public classBigintegerdemo { -      Public Static voidMain (string[] args) { -BigInteger BI1 =NewBigInteger ("100"); theBigInteger Bi2 =NewBigInteger ("50"); -  -         //Public BigInteger Add (BigInteger val): Plus -System.out.println ("Add:" +Bi1.add (BI2)); +         //Public BigInteger Subtract (BigInteger val): Plus -System.out.println ("Subtract:" +bi1.subtract (BI2)); +         //Public BigInteger Multiply (BigInteger val): Plus ASystem.out.println ("Multiply:" +bi1.multiply (BI2)); at         //Public BigInteger Divide (BigInteger val): Plus -System.out.println ("Divide:" +bi1.divide (BI2)); -  -         //Public biginteger[] Divideandremainder (BigInteger val): Returns an array of quotient and remainder -biginteger[] bis =Bi1.divideandremainder (BI2); -System.out.println ("Shang:" + bis[0]); inSystem.out.println ("remainder:" + bis[1]); -     } to}

The results are as follows:

Java basic Knowledge Strengthening the use of BigInteger subtraction method of 88:biginteger class

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.