java integer fill with leading zeros code example Example: java number padding zeros System.out.println(String.format("%03d", 4)); // 004