Java – use BigInteger multiply operator
•
Java
I wonder if there is a way to multiply BigInteger variables because the * operator cannot be applied to BigInteger
So I wonder if I can multiply two BigIntegers without using the * operator
Solution
You use the BigIntegers multiply() method as follows:
BigInteger int1 = new BigInteger("131224324234234234234313"); BigInteger int2 = new BigInteger("13345663456346435648234313"); BigInteger result = int1.multiply(int2)
I should have pointed out not long ago that BigInteger is immutable Therefore, any result of an operation must be stored in a variable The operator or operand never changes
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码