Specyfikator formatu w Javie
int input = 42;
System.out.print("Prefixed with necessary zeroes to make output length a total of 8 characters, including the positive sign: " + String.format("%+08d\n", input)); // This will print +0000042
System.out.print("Octal output: " + String.format("%o\n", input)); // This will print 52
System.out.print("Hex output: " + String.format("%x\n", input)); // This will print 2a
CompSciGeek