| Author |
Storing really big numbers (i.e. 640 bytes)
|
Justin Porter
Ranch Hand
Joined: Nov 20, 2004
Posts: 34
|
|
|
A long is pretty long, but not long enough. I'm working on cryptography right now and I'm trying to figure out how to store very large numbers (with 250 or so digits) using primitive or non-primitive data types. If I was to use a non-primitive data type, could I still do basic mathematical computations with it? How would I go about doing this? Thanks!
|
Want a free iPod, digital camera, or $300 cash? Completely legit offer at <a href="http://www.geocities.com/pricklymustard/freestuff.html" target="_blank" rel="nofollow">http://www.geocities.com/pricklymustard/freestuff.html</a> . I am looking for referrals which is why I need YOU!
|
 |
M Beck
Ranch Hand
Joined: Jan 14, 2005
Posts: 323
|
|
in Java, integers that size will not fit into any primitive data type, no. the standard library does have a class to handle them (BigInteger, in java.math). but this being Java, you can't use ordinary arithmetical operators on them - you have to say things like: in other words, use method calls on the BigInteger objects for everything. yes, i imagine this might get tiresome pretty quickly, but that's the way it is.
|
 |
Justin Porter
Ranch Hand
Joined: Nov 20, 2004
Posts: 34
|
|
|
Ok thanks, I'll look up the BigInteger class in the API. Thanks for the quick response!
|
 |
 |
|
|
subject: Storing really big numbers (i.e. 640 bytes)
|
|
|