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.
kharri5 0 Junior Poster in Training
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,889 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.