java – 使用BigInteger Multiply运算符

我想知道是否有办法将BigInteger变量相乘,因为*运算符不能应用于BigInteger.

所以我想知道是否可以在不使用*运算符的情况下将两个BigInteger相乘.

解决方法

您使用 BigIntegers multiply()方法,如下所示:
BigInteger int1 = new BigInteger("131224324234234234234313");
BigInteger int2 = new BigInteger("13345663456346435648234313");
BigInteger result =  int1.multiply(int2)

我应该在不久前指出BigInteger是不可变的.因此,操作的任何结果都必须存储到变量中.操作符或操作数永远不会更改.

相关文章

最近看了一下学习资料,感觉进制转换其实还是挺有意思的,尤...
/*HashSet 基本操作 * --set:元素是无序的,存入和取出顺序不...
/*list 基本操作 * * List a=new List(); * 增 * a.add(inde...
/* * 内部类 * */ 1 class OutClass{ 2 //定义外部类的成员变...
集合的操作Iterator、Collection、Set和HashSet关系Iterator...
接口中常量的修饰关键字:public,static,final(常量)函数...