使用BigInteger Multiply运算符 [英] Using BigInteger Multiply operator

查看:133
本文介绍了使用BigInteger Multiply运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有办法将 BigInteger 变量加在一起,因为无法应用 * 运算符到 BigInteger

I was wondering if there was a way to multiply BigInteger variables together, because the * operator cannot be applied to BigInteger.

所以我想知道是否可以在不使用的情况下将两个 BigIntegers 相乘* operator。

So I was wondering if it was possible to multiply two BigIntegers together without using the * operator.

推荐答案

您使用 BigInteger s 乘以()这样的方法:

You use BigIntegers multiply() method like so:

BigInteger int1 = new BigInteger("131224324234234234234313");
BigInteger int2 = new BigInteger("13345663456346435648234313");
BigInteger result =  int1.multiply(int2) 

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

I should have pointed out a while ago that BigInteger is immutable. So any result of an operation has to be stored into a variable. The operator or operand are never changed.

这篇关于使用BigInteger Multiply运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆