Possible Duplicate:
Large Numbers in Java
I need to take and manipulate an integer input with <= 500 digits. How can it be done in java? Any help would be appreciated.
Possible Duplicate:
Large Numbers in Java
I need to take and manipulate an integer input with <= 500 digits. How can it be done in java? Any help would be appreciated.
The BigInteger class is a good place to start for big ints.
I'll have to check the documentation to see what the upper bound on BigInteger
is, but it should suit your needs.
import java.math.BigInteger;
public class BigIntegerExample
{
public static void main(String[] args)
{
BigInteger bigInteger1 = new BigInteger ("123456789");
BigInteger bigInteger2 = new BigInteger ("112334");
BigInteger bigIntResult = bigInteger1.multiply(bigInteger2);
System.out.println("Result is ==> " + bigIntResult);
}
}
You can take as long value in integer using Biginteger class.