日期:2014-05-20 浏览次数:20890 次
public static void main(String[] args) {
long startTime = System.nanoTime();
try {
File file = new File("F:\\old.gif");
File newfile = new File("F:\\new.gif");
FileInputStream in = new FileInputStream(file);
FileOutputStream out = new FileOutputStream(newfile);
byte[] b = new byte[1024];
while(in.read(b,0,1024)!=-1){
out.write(b,0,1024);
}
in.close();
out.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e){
e.printStackTrace();
}
long time = System.nanoTime()-startTime;
System.out.println(time/(1000*1000)+"ms");
}