Files
Java_utils_enhance/src/main/java/util/zip/PrintTool.java
T
2021-10-26 19:20:52 +08:00

22 lines
637 B
Java

package util.zip;
import org.springframework.util.StopWatch;
import java.io.File;
class PrintTool {
static void calculateTimeAndLength(File[] files, StopWatch stopWatch, File resultFile){
//计算一下文件的大小
double length = 0.0000;
for (File file : files) {
length = length + file.length();
}
System.out.println(
"文件大小:" + length / 1024.00 / 1024.00 + "M,转换时间:" + stopWatch.getTotalTimeMillis() / 1000.000 + " s," + "压缩后文件大小:" + resultFile
.length() / 1024.00 / 1024.00 + " M");
}
}