Here you can find the source of formatSpeed(int value)
public static String formatSpeed(int value)
//package com.java2s; import java.util.Locale; public class Main { public static String formatSpeed(int value) { return formatSize(value) + "/s"; }// w w w .jav a 2 s . com public static String formatSize(long value) { double k = (double) value / 1024; if (k == 0) { return String.format(Locale.CHINA, "%d B", value); } double m = k / 1024; if (m < 1) { return String.format(Locale.CHINA, "%.2f K", k); } double g = m / 1024; if (g < 1) { return String.format(Locale.CHINA, "%.2f M", m); } return String.format(Locale.CHINA, "%.2f G", g); } }