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 fieldToParams(String fieldName) {

    for (char a : fieldName.toCharArray()) {
        if (a >= 65 && a <= 90) {
            fieldName = fieldName.replaceFirst(String.valueOf(a), "_" + a);
        }// www .  j  ava  2  s  . c o m
    }
    fieldName = fieldName.toUpperCase();
    return fieldName;
}

From source file:Main.java

public static String getDayFromNumber(int day) {
    if (day < 0 || day > 30)
        throw new IllegalArgumentException();
    if (day <= 10)
        return String.valueOf(Character.toChars(1487 + day));
    else if ((day >= 11 && day <= 14) || (day >= 16 && day <= 19)) {
        char yod = Character.toChars(1497)[0];
        return String.valueOf(new char[] { yod, Character.toChars(1487 + (day - 10))[0] });
    } else if (day == 15 || day == 16) {
        char tet = Character.toChars(1498)[0];
        return String.valueOf(new char[] { tet, Character.toChars(1487 + (day - 9))[0] });
    } else if (day == 20) {
        return String.valueOf(Character.toChars(1499)[0]);
    } else if (day >= 21 && day <= 29) {
        char chaf = Character.toChars(1499)[0];
        return String.valueOf(chaf + Character.toChars(1487 + (day - 20))[0]);
    } else {//from  ww  w. j av a 2  s .  c o  m
        return String.valueOf(Character.toChars(1500)[0]);
    }

}

From source file:Main.java

static String GenRandomNumber(int iLen) {
    String s = "";
    for (int i = 0; i < iLen; ++i) {
        int r = new Random().nextInt(10);
        s += String.valueOf(r);
    }//from  www  . j a v  a  2 s  .c  om

    return s;
}

From source file:Main.java

public static String convert_pw_to_string_no_commas(ArrayList<Integer> int_array) {
    String output = "";
    for (int elem : int_array) {
        output += String.valueOf(elem);
    }//from  w  w w  .j  a  v  a  2  s. co  m
    return output;
}

From source file:Main.java

private static String converTodu(double mAzim) {
    // TODO Auto-generated method stub
    String result = "000";
    int i = (int) mAzim;
    if (i > 100) {
        result = String.valueOf(i);
    } else {/*from   w w  w  .  j  a  v a 2 s .  co m*/
        result = "0" + String.valueOf(i);
    }
    return result;
}

From source file:com.moviejukebox.model.enumerations.JukeboxStatistic.java

/**
 * Convert a string into an Enum type//  w  ww  .  j  ava 2 s .  c om
 *
 * @param jukeboxStatistic
 * @return
 * @throws IllegalArgumentException If type is not recognised
 *
 */
public static JukeboxStatistic fromString(String jukeboxStatistic) {
    if (StringUtils.isNotBlank(jukeboxStatistic)) {
        try {
            return JukeboxStatistic.valueOf(jukeboxStatistic.trim().toUpperCase());
        } catch (IllegalArgumentException ex) {
            throw new IllegalArgumentException("JukeboxStatistic " + jukeboxStatistic + " does not exist.", ex);
        }
    }
    throw new IllegalArgumentException("JukeboxStatistic must not be null");
}

From source file:Main.java

/**
 * 01 02 12 zhuang 1 2 12/*www.j a  v  a2  s. c  om*/
 *
 * @param data
 * @return
 */
public static String changeData_month(String data) {
    char[] chars = data.toCharArray();
    if (String.valueOf(chars[0]).equals("0")) {
        data = String.valueOf(chars[1]);
    } else {
        data = data;
    }
    return data;
}

From source file:Main.java

public static String GetTime(long whs) {
    String time = "";
    long h = whs / 3600000;
    long m = (whs / 60000) % 60;
    long s = (whs / 1000) % 60;
    time += String.valueOf(h);
    if (String.valueOf(m).length() < 2)
        time += ":0" + String.valueOf(m);
    else//from  w  w w . j av  a2s  .  c  o  m
        time += ":" + String.valueOf(m);

    if (String.valueOf(s).length() < 2)
        time += ":0" + String.valueOf(s);
    else
        time += ":" + String.valueOf(s);
    return time;
}

From source file:Main.java

public static String safeGetIdName(Resources resources, int id) {
    if (resources == null) {
        return String.valueOf(id);
    }/*  w w w  .  ja va  2s  .c  o m*/
    try {
        return resources.getResourceEntryName(id);
    } catch (Resources.NotFoundException e) {
        return String.valueOf(id);
    }
}

From source file:Main.java

protected static String getFileKeyName(String extension, Context context) {
    String keyName = null;/*from   ww  w  .j a v a  2 s .  c  o  m*/

    keyName = String.valueOf(System.currentTimeMillis());
    String deviceId = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
    keyName = deviceId + "_" + keyName + "." + extension;

    return keyName;
}