I am trying to write a program in Java that takes in someons hexidecimal input. To make it eaiser I just want to do two digit hex. So they put in A2, and then I want the binary output for that. What I do know how to do is put a decimal to binary, so I wanted to try and say okay put A to be 10 in decimal, and 2 to be...well 2 in decimal. break the two into 4 bit arrays and do the binary for each, then comibe each togther into an 8 bit array and thats the binary, then from there I could try and do decimal, and octal by multipliying the necessary 1*2^(slot position) etc. My problem is figuring out how the hell to tell the computer that A means 10 and F means 15. I have no idea how to write this bloody thing. If anyone knows I woudl greatly appreciate, i've been trying to google it with less than satisfactory results.
Recommended Answers
Jump to PostI wonder if you'll have to do any bit shifting. hmm. I'll have to do some searching and see what I can find. I know I did this in vb.net(except I took regular …
Jump to PostHi everyone,
kharri5 you can try the below link. It really came useful to me.
http://www.janeg.ca/scjp/oper/binhex.html
You will need to use the modulus function most of time. The above link …
All 7 Replies
server_crash
64
Postaholic
kharri5
0
Junior Poster in Training
freesoft_2000
9
Practically a Master Poster
server_crash
64
Postaholic
kharri5
0
Junior Poster in Training
jwenting
1,855
duckman
Team Colleague
kharri5
0
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.