Converting Binary to Hex
trytryagain
Posts: 26
Peter,
First of all thanks for all the great information
I've read from your posts.
I am new to javelin stamp and I'm trying to convert some binary inputs to hex.
The Format.printf works great printing out to the debugger
but I need these values in my code.
Is there a method to store the hex info as a string and build it as it comes in?
while (fingerReceive.byteAvailable() == true)
{
b = (char)fingerReceive.receiveByte();
Format.printf("%x",b);
}
Thanks for taking a look at this
Jeff
·
First of all thanks for all the great information
I've read from your posts.
I am new to javelin stamp and I'm trying to convert some binary inputs to hex.
The Format.printf works great printing out to the debugger
but I need these values in my code.
Is there a method to store the hex info as a string and build it as it comes in?
while (fingerReceive.byteAvailable() == true)
{
b = (char)fingerReceive.receiveByte();
Format.printf("%x",b);
}
Thanks for taking a look at this
Jeff
·
Comments
to a char[noparse]/noparse rather than System.out
regards peter
·
I am getting wacky results that differ from the original
with this code:
cIndex = 0;
while (fingerReceive.byteAvailable() == true)
{
b = (char)fingerReceive.receiveByte();
cIndex = Format.bprintf(cBuffer,cIndex,"%x",b);
String s = Integer.toString(cBuffer[noparse][[/noparse]cIndex]);
cIndex = cIndex + 1;
buffer.append(s);
}
System.out.println(buffer.toString());
Data seems to be getting lost with my method above.
Is there an easier loop to concat and show the entire string?
Thanks
Jeff
·
regards peter
Post Edited (Peter Verkaik) : 9/22/2009 10:29:47 PM GMT