Date date = new Date();    
int number = 1;
for (X x :x ) {
    String no = String.format("ZG" + sf.format(date) + "%05d", number);
    number++;
    System.out.println("生成的编号:" + no);//ZG2023042400001
}

鸣蜩IV
4 声望5 粉丝