Maddoga Maddoga - 1 year ago 105
Java Question

Working beyond Max Value (Java)

I have a problem that requires me to go well beyond the Max Value of Integers in Java. How can I have an exception so that Java will let me do this, or get around these rules of Java?

Answer Source

Use a long value or Long wrapper.

When you've reached Long.MAX_VALUE then use BigInteger, which has a very large capacity, at least from -2^Integer.MAX_VALUE to 2^Integer.MAX_VALUE.

Come back for additional tips when BigInteger is no longer enough.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download