Here you can find the source of convertDecimal(long l)
public static String convertDecimal(long l)
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; public class Main { private static DecimalFormat nf = new DecimalFormat(); /**//from w ww . j a v a2 s .c o m * Converts a given number to a value in KiloByte. Also uses dots for 1000s. */ public static String convertDecimal(long l) { long l2 = l / 1024; if (l2 == 0 && l != 0) l2 = 1; return nf.format(l2) + " KB"; } }