class Main {
public static void main(String[] args) {
// 05d pads with zeros to width 5
System.out.println(String.format("%05d", 42));
// +04d also forces the sign
System.out.println(String.format("%+04d", -7));
}
}leading zeros with a format spec