How do I set a very LARGE value to a long in java?
Assume We’ve the pursuing check
in case num > (9999999999) num < 1000000000)
//do whatever
How to go about achieving this I won’t be able to use these values because they are properly above maxint, and I find it hard to set an extended or any double, because I can set these using a good int value:Example
much time x = 9999999999; // Can not set considering 9999999999 is definitely above maxint.
help
You need to use this BigInteger class
http://download.oracle.com/javase/6/docs/api/java/math/BigInteger.html
Here’s a fairly easy example:
http://www.java-tips.org/java-se-tips/java.math/how-to-operate-with-big-integer-values-in-code.code.
Leave a Reply
You must be logged in to post a comment.