java大数取余

java大数取余:

类方法:BigInteger.divideAndRemainder()

返回一个数组,key = 0为商key = 1为余数

import java.util.*;
import java.math.*;
public class Main{

    public static void main(String[] args) {
        BigInteger num=BigInteger.valueOf(13);
        BigInteger num1[] = //remermber
                num.divideAndRemainder((BigInteger.valueOf(7)));
        System.out.println(num1[1]);
    }

}

 

posted @ 2017-02-11 11:04  朤尧  阅读(745)  评论(0编辑  收藏  举报