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 getMinute(int Minute) {
    String MinuteStr = "";
    if (Minute < 10) {
        MinuteStr = "0" + Minute;
    } else {/*from  ww w.  j a v a 2 s.c om*/
        MinuteStr = String.valueOf(Minute);
    }

    return MinuteStr;
}

From source file:Main.java

public static String lowerFirstLetter(String string) {
    if (isEmpty(string) || !Character.isUpperCase(string.charAt(0))) {
        return string;
    }/*from   w ww.  j a  v  a2 s .c  o m*/
    return String.valueOf((char) (string.charAt(0) + 32)) + string.substring(1);
}

From source file:Main.java

/**
 * /*from www.  ja v a  2  s .  com*/
 * @param obj
 * @return
 */
public static String object2String(Object obj) {

    String str = "";
    if (obj != null) {

        str = String.valueOf(obj);
    }

    return str;
}

From source file:Main.java

public static String upperFirstLetter(String string) {
    if (isEmpty(string) || !Character.isLowerCase(string.charAt(0))) {
        return string;
    }/* w  ww  .  j  a  va2 s .com*/
    return String.valueOf((char) (string.charAt(0) - 32)) + string.substring(1);
}

From source file:Main.java

public static String formatDayFromPicker(int day, int month, int year) {
    String dayS, monthS;/*  www.ja  v a2  s  .  c om*/
    month++;

    if (day < 10) {
        dayS = "0" + String.valueOf(day);
    } else {
        dayS = String.valueOf(day);
    }

    if (month < 10) {
        monthS = "0" + String.valueOf(month);
    } else {
        monthS = String.valueOf(month);
    }

    return dayS + "/" + monthS + "/" + String.valueOf(year);
}

From source file:Main.java

public static int getPrefInt(SharedPreferences pref, String key, int def_value) {
    try {//from  www .ja  v a2  s.  com
        String value = pref.getString(key, String.valueOf(def_value));
        return Integer.parseInt(value);
    } catch (Exception e) {
        // Do nothing
    }
    return def_value;
}

From source file:Main.java

private static String byteToNum(byte bByte) {
    int iRet = bByte;
    System.out.println("iRet1=" + iRet);
    if (iRet < 0) {
        iRet += 256;/*w ww.  j a va 2  s .  com*/
    }
    return String.valueOf(iRet);
}

From source file:Main.java

public static String join(Object[] o, String flag) {
    StringBuffer str_buff = new StringBuffer();
    for (int i = 0, len = o.length; i < len; i++) {
        str_buff.append(String.valueOf(o[i]));
        if (i < len - 1)
            str_buff.append(flag);//ww  w  . j ava  2 s.  c o  m
    }
    return str_buff.toString();
}

From source file:Main.java

public static String formatFileName(String type, long recordId, long size, String ext) {
    String c = "-";
    String dot = ".";
    return type + c + recordId + c + Integer.valueOf(String.valueOf(size), 16) + dot + ext;
}

From source file:Main.java

public static String transferAVG_RTT(String oldValue) {
    String newValue = oldValue;//www.ja va2 s . c o m
    float ov = Float.valueOf(oldValue);
    newValue = String.valueOf(Math.floor(ov + 0.5));
    return newValue;
}