Issue
I want to format int numbers as hex strings. System.out.println(Integer.toHexString(1));
prints 1
but I want it as 0x00000001
. How do I do that?
Solution
Try this
System.out.println(String.format("0x%08X", 1));
Answered By - Drogba
I want to format int numbers as hex strings. System.out.println(Integer.toHexString(1));
prints 1
but I want it as 0x00000001
. How do I do that?
Try this
System.out.println(String.format("0x%08X", 1));