Quantcast
Channel: User AHungerArtist - Stack Overflow
Viewing all articles
Browse latest Browse all 38

Answer by AHungerArtist for Long vs BigInteger

$
0
0

BigInteger is capable of holding far bigger numbers than Long. BigInteger seems capable of holding (2 ^ 32) ^ Integer.MAX_VALUE, though that depends on the implementation (and, even if truly unbounded in the implementation, there will eventually be a physical resource limit) See explanation here.

The range of Long is [-9,223,372,036,854,775,808, +9,223,372,036,854,775,807].

Long will perform better than BigInteger so it really depends on what the size of your values will be. If they would all fall under Long's max value, it makes no sense not to use Long. If any would be bigger than the Long max value, you pretty much have to use BigInteger.


Viewing all articles
Browse latest Browse all 38

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>