| 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: 682
|
|
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
Bartender
Joined: Aug 16, 2005
Posts: 12950
|
|
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: 682
|
|
So, is there both "BigInt" and "BigInteger"? Kaydell
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12950
|
|
|
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.<br /> <br />#:^P
|
 |
 |
|
|
subject: Long just isn't long enough ..
|
|
|