这里只需要修改 %04d 中的4即可设置生成几位数

 

 /**
     * 获取下一个编号
     * @param startValue  上一个编号
     * @return
     */
    public static String getNext(int startValue) {
        AtomicInteger   val = new AtomicInteger(startValue);
        int nextVal = val.incrementAndGet();
        return String.format("%04d", nextVal);
    }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-08
  • 2022-03-06
  • 2021-08-11
  • 2021-07-12
  • 2022-03-04
  • 2021-06-15
猜你喜欢
  • 2022-12-23
  • 2022-01-13
  • 2021-07-13
  • 2021-11-29
  • 2022-12-23
  • 2022-01-03
  • 2022-12-23
相关资源
相似解决方案