Code example for DecimalFormat

Methods: format

0
            return ""; 
        } 
    } 
 
    public static String toHumanReadbleFormat(long size) {
        NumberFormat nf = new DecimalFormat("0.#");
        String s;
        float f;
        if (size / (1024 * 1024) > 0) {
            f = size;
            s = nf.format(f / (1024 * 1024)) + " GB";
        } 
        else if (size / (1024) > 0) {
            f = size;
            s = nf.format(f / (1024)) + " MB";
        } 
        else { 
            f = size;
            s = nf.format(f) + " bytes";
        } 
        return s;
    } 
     
    public static String highlightSyntax(String data, boolean highlight, String fileName) {