String str_f = str.substring(0, 1); int i = (Integer.parseInt(str.substring(1)) + 1); // 数字补齐0 DecimalFormat df = new DecimalFormat("0000"); String str_b = df.format(i); String factory_id = str_f + str_b; System.out.println(factory_id);