title: How to add two numbers of any length in java?
body: <p>How to add two numbers of any length in java?</p>
  
  <p>Say for example, in java long size is 64 bit. So the maximum range is -9223372036854775808 to 9223372036854775807. Am i right? </p>
  
  <p>So if we want to add a number which is greater than this like below, i got a error </p>
  
  <p>" Integer Number too large"</p>
  
  <blockquote>
    <p>long a = 9223372036854775807L; <br/>
    long b
    = 9223372036854775808L;</p>
  </blockquote>
  
  <p>In C, we can take those numbers as char array, by traversing through the address of each char and use some data structure, we can add two numbers of any size.</p>
  
  <p>How to do it java. Can we traverse through the address of each character in String.</p>
  
  <hr>
  
  <p>Thanks for your responses.</p>
  
  <p>I have tried to code by passing the numbers as string and add each character from the end. It works fine for me.</p>
  
  <p>Is there any big difference between the addition of two very large numbers using BigInteger and the method, i specified above (add each character from end and store remainder in temporary variable and goes on).
  Is the underlying mechanism of BigInteger is same as my code(add each character from end)?</p>
  
  <p>Thanks.</p>