防止重名,需要重命名

public class FileRenameUtil {
public static StringBuffer fileRename(){
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
String time = sdf.format(new Date());
StringBuffer buf = new StringBuffer(time);
Random r = new Random();
for(int x=0;x<3;x++){//循环取得三个不大于10的随机整数
buf.append(r.nextInt(10));
}
return buf;
}
}

相关文章:

  • 2022-02-27
  • 2022-12-23
  • 2022-12-23
  • 2022-02-13
  • 2022-12-23
  • 2022-12-23
  • 2021-09-26
  • 2022-12-23
猜你喜欢
  • 2021-04-27
  • 2022-12-23
  • 2021-12-11
  • 2021-06-14
  • 2022-12-23
  • 2022-12-23
  • 2021-07-01
相关资源
相似解决方案