Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How long can a string be?

807588Feb 12 2009 — edited Feb 12 2009
EDIT: The diagram came out bad but basically all the numbers are lined up evenly to the right and the x designates which numbers will be added

Basically I'm making a program that reads in two binary numbers, does binary addition, and then convert it to decimal representation. Basically I'm lining up all the powers of twos and adding them and I store the result of each column in a string and I basically keep updating that string add the next column result. Here's a representation of what I'm doing:

binary#: 10101101 = 181 base 10
        
              1   x  
              2
              4   x  
              8
            16   x
            32   x
            64
          128   x
-------------------------
            21   x
-------------------------
            8    x
------------------------
          1     x
The trick to this program is it has to work for 100 bit binary numbers and mine works up until like the 35th bit so I'm guessing it has to do with String size limit if there is one? Does anyone have an idea on how else I can store the result of each column if this is the case?

Edited by: ChrisTheSixth on Feb 12, 2009 10:05 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 12 2009
Added on Feb 12 2009
14 comments
5,171 views