继续学习BigInteger的其他方法的用法。
工具/原料
1
电脑
2
java
方法/步骤
1
返回两个中最小的数字。BigInteger min = b1.min(b2);
2
返回两个中最大的数字。BigInteger max = b1.max(b2);
3
当参数是BigInteger类型的数字并且数值相等的时候返回true。参数可以是其他类型
4
比较两个数的大小,相等返回0int i = b1.compareTo(b2);
5
比较两个数的大小,大于返回1int i = b1.compareTo(b2);
6
比较两个数的大小,小于返回-1int i = b1.compareTo(b2);
注意事项
要区分equals和compareTo。