zoukankan      html  css  js  c++  java
  • JAVA计算文件大小

    File f = new File(save_path+File.separator + resouce_id+".zip");
            FileInputStream fis = new FileInputStream(f);
            
            String resource_size = "";
    
            DecimalFormat df = new DecimalFormat("#.##");
            
            double resourcesize = (double)((double)fis.available()/1024);
            
            if((double)((double)fis.available()/1024)>1000)
            {
                resource_size =df.format((double)((double)fis.available()/1024/1024))+"MB";
            }
            else
            {
                resource_size =df.format((double)((double)fis.available()/1024))+"KB";
            }
  • 相关阅读:
    spoj705
    bzoj2440
    spoj220
    bzoj2301
    hdu1695
    poj3294
    hdu3518
    poj3693
    函数
    样式
  • 原文地址:https://www.cnblogs.com/kgdxpr/p/3190619.html
Copyright © 2011-2022 走看看