Integer number too large? - Mike Myatt

Hi, my name is Mike Myatt and I have a problem : when working with a 12 digits integer it gives me the following error:ERROR: integer number too large: 100000000000What can I do to work with bigger numbers?Thanks in advance!Mike Myatt
[269 byte] By [mrmikemyatta] at [2007-11-26 17:48:53]
# 1

An int can hold a maximum value of 2147483647. Use a long instead: it can hold a number upto 9223372036854775807. If that's still too small, use the java.math.BigInteger class for arbitrary-precision (mathematical) integers.

http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigInteger.html

prometheuzza at 2007-7-9 5:01:19 > top of Java-index,Java Essentials,Java Programming...
# 2

Just anticipating your next question:

If you write this:

long big = 100000000000;

You will get a compile-time error message such as "integer number too large: 100000000000". You must suffix the literal value with L for long:

long big = 100000000000L;

If you want to dirve anyone else who looks at your code crazy, lowercase L does the same thing:

long big = 100000000000l;

DrLaszloJamfa at 2007-7-9 5:01:19 > top of Java-index,Java Essentials,Java Programming...