Hello.

I wonder if someone can please help me on this programming code. I need to convert A to binary, representing the answer as an 8-bit unsigned binary number. can anyone help me please on how to do this. thank you...

Raza

Recommended Answers

All 3 Replies

There's an option to convert any number to a binary representation in the wrapper classes.

Use Character.getNumericValue(char) to get the numeric value of the character. There isn't a routine that converts a decimal number to a binary number, so I assume that's the part your professor wants you to work on. I'll give you a hint though.

+++++ Edit +++++
Never mind. jwenting knows a lot more than I do :).

You might have to do some magic with the resulting data from different conversions as not every wrapper class handles binary the same way (and of course they're usually not 8 bits so you may have to discard some data).

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.