标签:
/** * 判断图片大小 * @return */ public static boolean judegImgMaxMin(String path){ boolean flog = true; File file = new File(path); DecimalFormat df = new DecimalFormat("#.00"); String str = df.format(file.length() / 1024.0); // 最大图片值为15k if (Float.parseFloat(str) > 15) { flog = false; } return flog; }
public static void main(String[] args) { String path = "G:\\1.jpg"; judegImgMaxMin(path); // File file=new File(path); // DecimalFormat df = new DecimalFormat("#.00"); // System.out.println(df.format(file.length()/1024.0)); // System.err.println(NumberFormat.getNumberInstance().format(number)); // System.out.println(img+""); // String add=img.toString().getBytes().toString(); // byteImage(img, "1"); }
标签:
原文地址:http://blog.csdn.net/itlqi/article/details/45094395