Possible Duplicate:
How to add two numbers of any length in java?
can anyone help me with this?
what i need to do is to add a very large number that a calculator doesn't hold.
this is the code i have though it can only hold a number until 2147483647.. any number higher than that i get the error message stating "integer number too large"
can anyone tell me how can i use a larger number?
import java.math.BigDecimal;
public class AddTwoBigNumbers{
  public static void main() {
  BigDecimal num1, num2;
  num1 = new BigDecimal(2147483647);
  num2 = new BigDecimal(2147483647);
  Sum(num1, num2);
  }
  public static void Sum(BigDecimal val1, BigDecimal val2){
  BigDecimal sum = val1.add(val2);
  System.out.println("Sum of two BigDecimal numbers: "+ sum);
  }
}
 
     
     
     
     
     
     
    