This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes 99999999999 is out of range Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "99999999999 is out of range" Watch "99999999999 is out of range" New topic
Author

99999999999 is out of range

Anton Hassan
Greenhorn

Joined: Nov 15, 2003
Posts: 2
I have the following declaration:
static long MAXNUMBER = 99999999999;
Why do I get an error message: "99999999999"? Isn't the largest number for long is "(2 to the power of 63) - 1"?
I'm using Eclipse as the IDE.
Help. Thank you.
Chris Harris
Ranch Hand

Joined: Sep 21, 2003
Posts: 231
Hi Anton,
If you want to get the max value of a long use:

The max value is 9223372036854775807.
If you want to set a long to 9999999999 try

Hope that helps
Chris


SCJP 1.2, SCWCD, SCBCD
Anton Hassan
Greenhorn

Joined: Nov 15, 2003
Posts: 2
Thank you, Chris.
I wanted to make 99999999999 a long and your advice was a great help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 99999999999 is out of range
 
Similar Threads
Tech Word Game
For Loop Performance
range of long data type
Is there something wrong ..
WA #2 ..... word association