Here you can find the source of formatiereSpeichergroesse(long bytes)
static String formatiereSpeichergroesse(long bytes)
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; public class Main { static final DecimalFormat DF_2 = new DecimalFormat("#,##0.00"); static String formatiereSpeichergroesse(long bytes) { if (bytes < 0) return "0 Byte"; if (bytes < 1024) return "" + bytes + " Byte"; double b = bytes / 1024.; if (b < 1024.) return DF_2.format(b) + " KByte"; return DF_2.format(b / 1024.) + " MByte"; }// ww w .j a va 2 s .co m }