469,927 Members | 1,983 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

converting number systems in java

8
Hi,

I have to write a program that will alow the user to specify a number (decimal, binary, or hexadecimal) and a base to convert to (decimal, binary, or hexadecimal) using subroutine methods and menu - so that the user can choose their options.

I know how to convert with these number systems on paper using a pencil. However, I am not sure how to covert them in a java program. (I am using ready to program). Is there a formula I could use? Like, to find the square of x, I can do sqrt x.. is there something similar for converting these number systems? If not, how can I do it in java?

I would appreciate any advice you could give me very much.

Thank you!!
Mar 5 '07 #1
5 3359
ria3
8
Any links so that I could learn how to do this would also be helpful.
Mar 5 '07 #2
r035198x
13,262 8TB
Any links so that I could learn how to do this would also be helpful.
What do you need sqrt for? You said you just want to convert between number bases. That does not require sqrt. If you know the methods then write down an algorithm for converting a number from a given base n to any base m. Then just convert that algorithm to a java program.
Mar 6 '07 #3
hirak1984
316 100+
did you try ria?

it is not that hard .Just think the steps you'd follow while doing conversions
and write codes accordingly.try it post errors,we are always here.
good luck.
Any links so that I could learn how to do this would also be helpful.
Mar 6 '07 #4
Ganon11
3,652 Expert 2GB
Maybe we can help you understand if you explain to us how you wouble convert a number from one system to another. For example, convert 563 decimal to binary.
Mar 6 '07 #5
ria3
8
thanks for the tips guys, i finally got it figured out! :)
Apr 8 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Joseph Suprenant | last post: by
15 posts views Thread by jaks.maths | last post: by
116 posts views Thread by Dilip | last post: by
10 posts views Thread by Frank Rizzo | last post: by
15 posts views Thread by allthecoolkidshaveone | last post: by
reply views Thread by florian.grimps | last post: by
1 post views Thread by icanhelp33 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.