//毫秒时间
String fileName = System.currentTimeMillis() + "";
File filePath = new File(fileName );
//用毫秒时间创建文件名
filePath .createNewFile();
//如果建立成功
if(filePath.exists())
{
..........................
}可我的方法组长说毫秒不行啊
因为很多人同时用说不准阿我应该怎么写才能不重复阿
String fileName = System.currentTimeMillis() + "";
File filePath = new File(fileName );
//用毫秒时间创建文件名
filePath .createNewFile();
//如果建立成功
if(filePath.exists())
{
..........................
}可我的方法组长说毫秒不行啊
因为很多人同时用说不准阿我应该怎么写才能不重复阿
String fileNamei = fileName+i;
File filePath = new File(fileName );if(filePath.exists())
{
getFilename(fileName,i+1);}else{
.........
}
|
String fileNamei = fileName+i;
File filePath = new File(fileNamei ); if(filePath.exists())
{
getFilename(fileName,i+1); }else{
.........
}
}