+ 2

as far as i know there is a limitation for numbers in java. how to assign bigger numbers in java

there is a maximum no. which we can assign to an integer in java what if we need more no. (Example int a = 9999999999999999999999999;) this is not supported in java what to do if i need to work on lager no.like the eg. one.

27th Mar 2017, 7:21 AM
shobhit
shobhit - avatar
7 Answers
+ 16
Sir @Krishna had written the code for big integer. check it out : https://code.sololearn.com/WS60ll19CFej/?ref=app
27th Mar 2017, 7:51 AM
Agus Mei
Agus Mei - avatar
+ 10
Thanks @Agus Mei. @shobhit : BigInteger is explained in the code linked by @Agus. There are example programs too.
27th Mar 2017, 9:18 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 10
use long keyword instead of int
29th Mar 2017, 5:36 AM
Saumya
Saumya - avatar
+ 9
you are using primitive datatype to store int you can also store integer value in reference datatype which you can create urself
29th Mar 2017, 11:08 AM
Saumya
Saumya - avatar
+ 2
you can use BigInteger
27th Mar 2017, 7:30 AM
T0nd3
+ 2
can u give any example how to use it
27th Mar 2017, 7:46 AM
shobhit
shobhit - avatar
+ 2
@sam i have tried long but long does something else it does 64bit computation.
29th Mar 2017, 9:13 AM
shobhit
shobhit - avatar