String.format() String format = "%0" + 5 + "d"; Integer num = 123; String result = String.format(format, num); 结果000123