You could usebut it's not much better.Code:String hex_value = String.format("0x%02x", i);
The best approach is to create a method in your own class which takes a byte as a parameter and returns the formatted string ie
Code:private String toHex(byte val) { return String.format("0x%02x", i); }




Reply With Quote