代码

    /**
     * 生成随机图片名
     */
    public static String genImageName() {
        //取当前时间的长整形值包含毫秒
        long millis = System.currentTimeMillis();
        //加上三位随机数
        Random random = new Random();
        int end3 = random.nextInt(999);
        //如果不足三位前面补0
        String str = millis + String.format("%03d", end3);
        return str;
    }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
  • 2022-02-17
  • 2022-12-23
  • 2021-07-08
  • 2021-12-12
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-03-08
  • 2022-12-23
  • 2021-11-30
  • 2021-12-10
相关资源
相似解决方案