Description Of BigInteger: divideAndRemainder(BigInteger val)
The
java.math.BigInteger.divideAndRemainder(BigInteger val) returns an array of two
BigIntegers containing (this / val) followed by (this % val).
Code Example Java BigInteger
import java.math.BigInteger;
public class BigIntegerExam {
public static void main(String[] args) {
BigInteger bi1 = new BigInteger("7");
BigInteger bi2 = new BigInteger("4");
BigInteger bi[] = bi1.divideAndRemainder(bi2);
System.out.println("length Of return " + bi.length);
System.out.println("Quotient is " + bi[0]); // 7/4
System.out.println("Remainder is " + bi[1]); // 7%4
}
}
ไม่มีความคิดเห็น :
แสดงความคิดเห็น