Android Int Format formatSpeed(int value)

Here you can find the source of formatSpeed(int value)

Description

format Speed

Declaration

public static String formatSpeed(int value) 

Method Source Code

//package com.java2s;

public class Main {
    public static String formatSpeed(int value) {
        return formatSize(value) + "/s";
    }/* w w w  .  j a v  a 2s.  co m*/

    public static String formatSize(long value) {

        double k = (double) value / 1024;
        if (k == 0) {
            return String.format("%dB", value);
        }

        double m = k / 1024;
        if (m < 1) {
            return String.format("%.1fK", k);
        }

        double g = m / 1024;
        if (g < 1) {
            return String.format("%.1fM", m);
        }

        return String.format("%.1fG", g);
    }
}

Related

  1. addCommas(int value)
  2. formatSpeed(int value)
  3. formatSpeed(int speed, String format)
  4. getDecimalFormat(int i, String numStr)
  5. formatGameSize(int size)
  6. formatId(String id)
  7. formatInt(int number)