Java tutorial
//package com.java2s; import java.text.DecimalFormat; import java.text.NumberFormat; public class Main { public static String byteToKB(int bt) { DecimalFormat df = (DecimalFormat) NumberFormat.getInstance(); df.setMaximumFractionDigits(2); return df.format(bt / 1024.0) + " KB"; } }