Reputation: 6922
I try to convert byte to the same string. Such as below:
byte b = (byte)0xAA;
Then, convert byte b to the same string as below:
String s = "AA";
How can I do it?
Upvotes: 0
Views: 141
Reputation: 66657
Byte.toString(b) will print String representation of String for specified byte 'b'
Upvotes: 0
Reputation: 261
Try this:
byte b = (byte)0xAB; String s = String.format("%x", b);
Upvotes: 4
Reputation: 7961
Have you tried using the Byte
class? It has toString()
methods you can use.
Upvotes: 0