Class BigInteger allows using big integer values; more than could fit in "int" or "long" type. Technically the number can be about 8 gigabytes (almost 70 billion bits) big; at which point you will probably worry about your computer memory and speed.

The values of this class are immutable. Which means that if you want another value, you will receive a new object instead of modifying an existing one. For example, this is how you would calculate 1000 + 1 using int and using BigInteger.

int i = 1000; i = i + 1; BigInteger bi = new BigInteger("1000"); bi = bi.add(BigInteger.ONE); // Don't do just this: // BigInteger bi = new BigInteger("1000"); // bi.add(BigInteger.ONE); // discards the result

viliam@bur.sk