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:Main.java

public static String formatTime(int what) {
    String dur = null;//  w ww .j av a 2  s. c o m
    dur = (what < 10) ? "0" + String.valueOf(what) : String.valueOf(what);
    return dur;
}

From source file:Main.java

public static String doubleTrans(double d) {
    if (Math.round(d) - d == 0) {
        return String.valueOf((long) d);
    }/*from w  w  w.  j  a v  a  2s  .co m*/
    return String.valueOf(d);
}

From source file:Main.java

public static String abbreviate(String s, int maxLength) {
    s = String.valueOf(s); // null check
    if (s.length() > maxLength) {
        s = s.substring(0, maxLength) + "...";
    }/*  w w w.  ja  va2 s  .c om*/
    return s;
}

From source file:Main.java

public static String generateReplyID() {
    long l = System.currentTimeMillis();
    return "RP" + String.valueOf(l) + String.valueOf((int) (1000.0D + Math.random() * 9000.0D));
}

From source file:Main.java

private static String getBucketedTime(long paramLong) {
    if (paramLong < 1000L)
        return String.valueOf(100L * (paramLong / 100L)) + "ms";
    return String.valueOf(Math.max(500L * (paramLong / 500L) / 1000.0D, 1.0D) + "s");
}

From source file:Main.java

public static String stringFromDouble(double value) {
    if (value % 1 == 0) {
        return String.valueOf((int) value);
    } else {/*from www  . ja v  a2s .  c  o m*/
        return String.format("%.2f", value);
    }
}

From source file:Main.java

public static String capitalize(final String word) {
    if (word.length() > 1) {
        return String.valueOf(word.charAt(0)).toUpperCase() + word.substring(1);
    }/*from  ww w . j  a va 2s.  c o  m*/
    return word;
}

From source file:Main.java

public static String getNumToStrCnvr(int srcNumber) {
    String rtnStr = null;

    rtnStr = String.valueOf(srcNumber);

    return rtnStr;
}

From source file:Main.java

public static String getTimeString() {
    Date d = new Date();
    return String.valueOf(d.getTime());
}

From source file:Main.java

public static String byteToHexString(byte[] bytes) {
    return String.valueOf(Hex.encodeHex(bytes));
}