How can I represent and use a large number in Java? In scientific computing there are a number of times that I need numbers to be greater than a long.
            Asked
            
        
        
            Active
            
        
            Viewed 122 times
        
    -1
            
            
         
    
    
        dimo414
        
- 47,227
- 18
- 148
- 244
 
    
    
        lacksledge
        
- 1
- 1
2 Answers
0
            
            
        You should use BigInteger for this..
They can be as large as you need - until you run out of memory.
eg:
BigInteger Bigintvar1 = new BigInteger("1234567890123456890");
BigInteger Bigintvar2 = new BigInteger("2743561234");
Bigintvar1 = Bigintvar1.add(Bigintvar2);
 
    
    
        Sarath
        
- 2,318
- 1
- 12
- 24
- 
                    I have tried it. thanks – lacksledge Jul 03 '15 at 08:28
