Hi all. So I was wondering, what if I want numbers larger than BigInteger? If I understand, I can use many variables or many BigIntegers as one number. I am wondering how I would do such a thing. I have searched around a bit but I will keep looking.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Hi all. So I was wondering, what if I want numbers larger than BigInteger? If I understand, I can use many variables or many BigIntegers as one number. I am wondering how I would do such a thing. I have searched around a bit but I will keep looking.
BigInteger has arbitrary bitlengths, and in theory can represent any integer. In practice, you'll run out of physical memory first or the OS/Java runtime will limit how much memory you have.
For a 1GB BigInteger, you can represent stupidly large numbers up to 2^4294967296. This is a 1,292,913,986 digit number.
This is significantly larger than the largest known prime as of Jan 15, 2013.
The only solution is to increase how much memory Java is allowed to use, or increase how much physical memory you have (or use virtual paged memory, though this is extremely slow).
is there a way to tell how much memory the variable is taking?