Example usage for java.lang String valueOf

List of usage examples for java.lang String valueOf

Introduction

In this page you can find the example usage for java.lang String valueOf.

Prototype

public static String valueOf(double d) 

Source Link

Document

Returns the string representation of the double argument.

Usage

From source file:Utils.java

public static final String format(long l) {

    String s = String.valueOf(l);
    int digits = 0;
    while (s.length() > 3) {
        s = s.substring(0, s.length() - 3);
        digits++;/* w ww .  j  a  v  a  2  s. com*/
    }
    StringBuffer buffer = new StringBuffer();
    buffer.append(s);
    if ((s.length() == 1) && (String.valueOf(l).length() >= 3)) {
        buffer.append(".");
        buffer.append(String.valueOf(l).substring(1, 3));
    } else if ((s.length() == 2) && (String.valueOf(l).length() >= 3)) {
        buffer.append(".");
        buffer.append(String.valueOf(l).substring(2, 3));
    }
    if (digits == 0) {
        buffer.append(" B");
    } else if (digits == 1) {
        buffer.append(" KB");
    } else if (digits == 2) {
        buffer.append(" MB");
    } else if (digits == 3) {
        buffer.append(" GB");
    } else if (digits == 4) {
        buffer.append(" TB");
    }
    return buffer.toString();

}

From source file:Main.java

public static String keep2Point(float paramFloat) {
    return String.valueOf(new BigDecimal(paramFloat).setScale(2, 4).floatValue());
}

From source file:Main.java

public static String keep0Point(float paramFloat) {
    return String.valueOf(new BigDecimal(paramFloat).setScale(0, 4).intValue());
}

From source file:Main.java

public static boolean isChinese(char c) {
    String regex = "[\\u4e00-\\u9fa5]";
    return String.valueOf(c).matches(regex);
}

From source file:Main.java

private static String getPage_number_string() {
    return String.valueOf(page_number);
}

From source file:Main.java

private static String formatTime(int millis) {
    return String.valueOf(millis / 1000.);
}

From source file:Main.java

public static String trasByteToM(long src) {
    int des = (int) (src /= 1024 * 1024);
    return String.valueOf(des);
}

From source file:Main.java

private static String getRealFileName(String name) {
    return String.valueOf(name.hashCode());
}

From source file:Main.java

public static String getSequenceId() {
    String mark = String.valueOf(System.currentTimeMillis());
    return mark;
}

From source file:Main.java

public static String getOsVersionCode(Context context) {
    return String.valueOf(android.os.Build.VERSION.SDK_INT);
}