Here you can find the source of getFileKBSize(long fsize)
Parameter | Description |
---|---|
fsize | file size |
public static String getFileKBSize(long fsize)
//package com.java2s; import java.text.NumberFormat; public class Main { /**/* ww w. j a v a 2s . c o m*/ * Retrieves the file size with KB format * * @param fsize file size * @return xxx,xxx KB */ public static String getFileKBSize(long fsize) { if (fsize < 0) { throw new IllegalArgumentException("File size can't be nagetive."); } long size = fsize / 1000; long li = fsize % 1000; if (li > 0) { size++; } return NumberFormat.getInstance().format(size) + " KB"; } }