wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Storing really big numbers (i.e. 640 bytes) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Storing really big numbers (i.e. 640 bytes)" Watch "Storing really big numbers (i.e. 640 bytes)" New topic

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!
I agree. Here's the link: http://aspose.com/file-tools
subject: Storing really big numbers (i.e. 640 bytes)
Similar Threads
equals method
Automate WS Client Program
serizalize primitive data type