aspose file tools*
The moose likes Beginning Java and the fly likes Long just isn't long enough .. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Long just isn Watch "Long just isn New topic
Author

Long just isn't long enough ..

Dave Jones
Ranch Hand

Joined: Feb 20, 2005
Posts: 77
Hi all,
I have a spec in which I'm required to hold a 20 digit number. as you know, long can hold (almost) up to 19 (2^63 -1).

Any suggestions ?

Thanks a lot
Dave
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689

The keyword to search for is the "BigInt" class.

Kaydell
Dave Jones
Ranch Hand

Joined: Feb 20, 2005
Posts: 77
Yup, I know about BigInt, and actually, I think that BigInteger is even better for my use, but isn't this solution a bit"too much" for what I need ?
isn't there something 'smaller' friendlier than this ?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114
    
  16

So long is too small, but you think BigInteger is too big? Why do you think that BigInteger is "too much" for what you need?

There's not really something in between...


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Dave Jones
Ranch Hand

Joined: Feb 20, 2005
Posts: 77
Well, reading a bit about BigInteger, I understood that it holds many options and possibilities, more than I need. So I was wondering if there is something in the middle.
If you say there isn't, well, BigInteger- here I come !!!

Thanks guys(and 'gals').
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689

So, is there both "BigInt" and "BigInteger"?

Kaydell
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114
    
  16

No, there is no "BigInt" in the standard Java API - you could have found this out quickly by looking at the API documentation.
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Do you actually need to do numerical computations with this 20-digit number? If not, maybe a String would do.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
 
 
subject: Long just isn't long enough ..