DecimalFormat df=new DecimalFormat("0.00");
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
float temp1=(float)file.getLen()/1024;
if(temp1<1024){
System.out.println(df.format(temp1)+" KB");
}else if(temp1>=1024 && temp1<1048576){
System.out.println(df.format((float)temp1/1024)+" M");
}else if(temp1>=1048576){
System.out.println(df.format((float)temp1/1048576)+" G");
}