package com.ruoyi.project.material.controller;
import java.text.DecimalFormat;
import java.util.concurrent.atomic.AtomicInteger;
public class test {
public static void main(String []args) {
DecimalFormat df = new DecimalFormat("000"); //设置格式
AtomicInteger z = new AtomicInteger(); //number线程安全方式增加或减少的对象
for(int i=0; i<1000; i++){
z.set(i);
System.out.println(df.format(z.get())); //df.format()转换number的格式
}
}
}
生成 000至999顺序排列的流水号
最新推荐文章于 2023-12-16 15:28:17 发布