import java.io.File;执行此代码给出:
public class main
{
public static void main(String[] args)
{
File file =new File(C:\\test.avi”);
if(file.exists()){
double bytes = file.length();
双位 = 字节 * 8;
双千字节 = 字节 / 1024;
双兆字节 = 千字节 / 1024;
双千兆字节 = 兆字节 / 1024;
双 TB = 千兆字节 / 1024;
System.out.println(位:” + 位 + 位”);
System.out.println(bytes: ” + bytes+ bytes”);
System.out.println(千字节:” + 千字节+ KB”);
System.out.println(兆字节:” + 兆字节 + MB”);
System.out.println(千兆字节:” + 千兆字节 + GB”);
System.out.println(太字节:” + 太字节 + 到”);
}else{
System.out.println(不存在的文件”);
}
}
}
bits: 4.624187392E9 bits参考:
bytes: 5.78023424E8 bytes
kilobyte: 564476.0KB
兆字节: 551.24609375MB
gigabyte: 0.5383262634277344GB
TB:5.257092416286469E-4TB
Please disable your ad blocker and refresh the window to use this website.