Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-13-2007, 10:54 PM
Member
 
Join Date: Jul 2007
Posts: 44
susan is on a distinguished road
Fibonacci Algorithm
I have written a little program to calculate Fibonacci numbers up to F(300).
If you have knowledge of Fibonacci, you'll know that the number get very large, very quickly.
i.e
F(300) =2222322446294204455297398934619099672066669390964 99764990979600

Obviously this number can't be stored in an Int or Long etc. To solve the issue I've used Java's BigInteger Class to store these numbers. It works well. However, I would like to understand how BigInteger works "under the hood". Does it store the numbers as byte arrays, as Strings etc?

Java's API for BigInteger doesn't seem to specify how it works in terms of how it stores numbers, just how to use the class. If anyone can explain, or point me in the direction of a write up on how BigInteger stores it's numbers that would be quite helpful.

Thanks.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-07-2007, 06:25 AM
Member
 
Join Date: Jul 2007
Posts: 40
cachi is on a distinguished road
Which makes me think that perhaps what they do is they create an array where each array element corresponds to a digit. That way you're not limited on size, per say. And with the many copy algorithms out there for increasing array size I wouldn't be surprised.

However this is only a guess.
I found the GNU Open Source BigInteger implementation which I would guess just about mimics it.

GNU BigInteger
Greetings.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing Fibonacci Numbers Java Tip java.lang 0 04-09-2008 08:43 PM
A Fibonacci printing program Java Tip Java Tips 0 03-28-2008 09:26 PM
Computing Fibonacci numbers recursively Java Tip Java Tips 0 01-22-2008 10:20 PM
Help with algorithm susan New To Java 1 07-14-2007 12:26 AM
Help me with this algorithm Marcus Advanced Java 3 07-02-2007 03:30 PM


All times are GMT +3. The time now is 11:27 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org