This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma 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

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "99999999999 is out of range" Watch "99999999999 is out of range" New topic

99999999999 is out of range

Anton Hassan

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

Anton Hassan

Joined: Nov 15, 2003
Posts: 2
Thank you, Chris.
I wanted to make 99999999999 a long and your advice was a great help.
Have you checked out Aspose?
subject: 99999999999 is out of range
It's not a secret anymore!