System.out.printf("Number = %03d", 3); String number = String.format("%03d", 3); System.out.println("Number = " + number);