class Formats {

    public static final String toMemorySize(long n) {
        if (n < (10l << 10)) {
            return String.valueOf(n);
        }
        else if (n < (10l << 20)) {
            return String.valueOf(n >> 10) + "k";
        }
        else if (n < (10l << 30)) {
            return String.valueOf(n >> 20) + "m";
        }
        else {
            return String.valueOf(n >> 30) + "g";
        }
    }

}