| Author |
Binary String to Hexadecimal value problem
|
J amodi
Greenhorn
Joined: Nov 09, 2011
Posts: 14
|
|
Hi,
I need to convert binary string (e.g 01110111) to hexadecimal value.
If I am using this code
then it is getting rid of initial 0s After converting in integer. above code will output me only "f" instead of "0f". Could anyone help me to resolve this issue ?
|
 |
Jeff Verdegan
Bartender
Joined: Jan 03, 2004
Posts: 3133
|
|
You already have one thread that seems to be the same as this one. Please UseOneThreadPerQuestion.(⇐click)
|
 |
Martin Vajsar
Bartender
Joined: Aug 22, 2010
Posts: 1219
|
|
|
There is a String.format() function, which takes a format string and a parameter (or parameters) and can be used to output formatted strings. The format string allows you to specify flags to modify the output of the method. I suppose you could put this method to good use, just look it up in the documentation.
|
 |
Mohamed Sanaulla
Bartender
Joined: Sep 08, 2007
Posts: 2694
|
|
Jeff Verdegan wrote:You already have one thread that seems to be the same as this one. Please UseOneThreadPerQuestion.(⇐click)
Is this the thread you were referring to? I am not sure if they are similar, as the other thread was converting Binary value to ASCII.
|
 |
Jeff Verdegan
Bartender
Joined: Jan 03, 2004
Posts: 3133
|
|
Mohamed Sanaulla wrote:
Jeff Verdegan wrote:You already have one thread that seems to be the same as this one. Please UseOneThreadPerQuestion.(⇐click)
Is this the thread you were referring to? I am not sure if they are similar, as the other thread was converting Binary value to ASCII.
Yeah, that's the one. I guess I was confused.
|
 |
 |
|
|
subject: Binary String to Hexadecimal value problem
|
|
|