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!

Converting Long String of numbers to the Hex.

807580Nov 24 2009 — edited Nov 25 2009
Hi Everyone,

Here is my challenge. I am given a very large number in a String. I am also given the maximum number of bits this number can occupy. However, this number probably will not fit into a standard Data Type such as long, int, or double. I also need to send this number to a piece of hardware in a hex code format. For simplicity sake lets say I am given the number can be up to 256 bits long (well above native Data Types) and lets say the user enters "257". Does anyone have an algorithm that will convert String "257" to hex 0101 without first converting the string to a number? Maybe taking each decimal position at a time? I am using a simple example, but the number will most likely be much larger than 257 and can end up larger than even BigInt can handle.

Thanks in Advance,
Kevin
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 23 2009
Added on Nov 24 2009
19 comments
721 views