Java Math BigInteger.divideAndRemainder() 方法


Java Math BigInteger.divideAndRemainder() 方法

package com.codingdict;



import java.math.*;



public class BigIntegerDemo {



   public static void main(String[] args) {



      // create 2 BigInteger objects

      BigInteger bi1, bi2;



      bi1 = new BigInteger("-100");

      bi2 = new BigInteger("3");



      // BigInteger array bi stores result of bi1/bi2

      BigInteger bi[] = bi1.divideAndRemainder(bi2);



      // print quotient and remainder

      System.out.println("Division result");

      System.out.println("Quotient is " + bi[0] );

      System.out.println("Remainder is " + bi[1] );

   }

}