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

private static String getVoiceTime(long time) {
    long seconds = Math.max((time / 1000), 1);
    long min = seconds / 60;
    long sec = seconds % 60;

    return ((min > 0) ? (String.valueOf(min) + "'") : "") + ((sec >= 0) ? (String.valueOf(sec) + "\"") : "");
}

From source file:Main.java

/**
 * //from   w w  w  .  j  a va 2 s  . co m
 * @param str
 * @return
 */
protected static String firstLetterToUpper(String str) {
    char[] array = str.toCharArray();
    array[0] -= 32;
    return String.valueOf(array);
}

From source file:Main.java

/**
 * /*  w  ww .ja v a 2s  .  c om*/
 * @param str
 * @return
 */
protected static String firstUpperToLetter(String str) {
    char[] array = str.toCharArray();
    array[0] += 32;
    return String.valueOf(array);
}

From source file:Main.java

public static String formatSize(long size) {
    long limit = 10 * 1024;
    long limit2 = limit * 2 - 1;

    if (size < limit)
        return String.valueOf(size) + " bytes";
    else {// w  w  w. j  a v a2  s .c o  m
        size >>= 9;
        if (size < limit2)
            return String.valueOf((size + 1) / 2) + " kB";
        else {
            size >>= 10;
            if (size < limit2)
                return String.valueOf((size + 1) / 2) + " MB";
            else {
                size >>= 10;
                if (size < limit2)
                    return String.valueOf((size + 1) / 2) + " GB";
                else {
                    size >>= 10;
                    return String.valueOf((size + 1) / 2) + " TB";
                }
            }
        }
    }
}

From source file:Main.java

public static String getStringTwo(String strIn) {
    String strResult;//from  ww  w  .  j  a va2  s.c o m
    if (strIn.length() >= 2) {
        strResult = strIn;
    } else {
        strResult = "0".concat(String.valueOf(String.valueOf(strIn)));
    }
    return strResult;
}

From source file:com.ocrix.ppc.commons.Validator.java

/**
 * Validates a {@link ThreadPoolType}/* w  w w . j av a  2  s . c  om*/
 * 
 * @param threadPoolType
 */
public static void validateThreadPoolType(String threadPoolType) {
    validateString(threadPoolType);
    try {
        ThreadPoolType.valueOf(threadPoolType);
    } catch (IllegalArgumentException e) {
        throw new IllegalArgumentException("The thread pool type does not match");
    }
}

From source file:Main.java

public static String getMethodName(String name) {
    char[] ch = name.toCharArray();
    ch[0] = Character.toUpperCase(ch[0]);

    return "get" + String.valueOf(ch);
}

From source file:Main.java

private static String AddYear(String paramString1, String paramString2) {
    int i = paramString2.indexOf("yyyy");
    return paramString1.substring(0, i).concat(String.valueOf(Calendar.getInstance().get(1)))
            .concat(paramString1.substring(i));
}

From source file:Main.java

public static String setMethodName(String name) {
    char[] ch = name.toCharArray();
    ch[0] = Character.toUpperCase(ch[0]);

    return "set" + String.valueOf(ch);
}

From source file:Main.java

public static String getName(Context context, ResolveInfo resolveInfo) {
    return String.valueOf(resolveInfo.loadLabel(context.getPackageManager()));
}