Java – how to obtain module int_ Max’s results?
•
Java
If I try to apply: integer valueOf(String.valueOf(Integer.MAX_VALUE)“9”);
But I need to get the remainder modulus from the string representation as integer MAX_ VALUE.
How can I do this?
UPD:Integer. valueOf(String.valueOf(Integer.MAX_VALUE)“9”); Just one example The value of the string may exceed the maximum value of long
Solution
You are looking for BigInteger This allows very large numbers to be used for mathematical operations
The following will allow you to use very large numbers for analog-to-digital:
BigInteger number = new BigInteger(myValueAsString); BigInteger intMax = BigInteger.valueOf(Integer.MAX_VALUE); BigInteger remainder = number.remainder(intMax);
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
二维码