I need to change a integer value into 2-digit hex value in Java.Is there any way for this. Thanks
My biggest number will be 63 and smallest will be 0. I want a leading zero for small values.
String.format("%02X", value);
If you use X
instead of x
as suggested by aristar, then you don't need to use .toUpperCase()
.