473,231 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

converting number systems in java


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 3541
Any links so that I could learn how to do this would also be helpful.
Mar 5 '07 #2
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
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
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
thanks for the tips guys, i finally got it figured out! :)
Apr 8 '07 #6

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

Similar topics

by: Joseph Suprenant | last post by:
I have an array of unsigned chars and i would like them converted to an array of ints. What is the best way to do this? Using RedHat 7.3 on an Intel Pentium 4 machine. Having trouble here, hope...
by: Clark Stevens | last post by:
I have a program that I'm converting from VB6 to VB.NET. It reads in a text file containing barcode numbers and their corresponding descriptions. Then the user enters the barcode number and the...
by: jaks.maths | last post by:
How to convert negative integer to hexadecimal or octal number? Ex: -568 What is the equivalent hexadecimal and octal number??
by: Dilip | last post by:
Recently in our code, I ran into a situation where were stuffing a float inside a double. The precision was extended automatically because of that. To make a long story short, this caused...
by: Frank Rizzo | last post by:
Given the inneficiencies of ArrayList and Hashtable on 64-bit systems, I am converting them to List<and Dictionary<respectively. It's a pretty massive system, so there are a lot of casts. For...
by: allthecoolkidshaveone | last post by:
I want to convert a string representation of a number ("1234") to an int, with overflow and underflow checking. Essentially, I'm looking for a strtol() that converts int instead of long. The...
by: florian.grimps | last post by:
Hello. I try to convert a bigger piece of java to c#. Initially I use the JLCA 3 form VS 2005, but the results are far from being perfect, so I had to convert much code on my own. I have big...
by: icanhelp33 | last post by:
whats the best way for converting vb.net application to C#
by: Dormilich | last post by:
I recently found a problem I haven't seen a good solution yet. this is just the general conversion from a number between number/notation systems (e.g. decimal, binary, octadecimal notation) ∞ ...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.