How to format numbers to a hex strings? August 18, 2023 by Tarik Try this System.out.println(String.format("0x%08X", 1));