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 byteToChar(byte[] ucPtr) {
    final StringBuffer sb = new StringBuffer();
    for (int i = 0; i < ucPtr.length; ++i) {
        char c = (char) ucPtr[i];
        sb.append(String.valueOf(c));
    }//from www. j av  a 2s . c om
    return sb.toString();
}

From source file:Main.java

public static <T> T checkNullArgument(T reference, @Nullable Object errorMessage) {
    if (reference == null) {
        throw new IllegalArgumentException(String.valueOf(errorMessage));
    }/*from  w  ww.  java 2 s  .  co m*/
    return reference;
}

From source file:Main.java

public static String putFriendshipAcceptRequestUrl(long friendshipId, long userId) {
    return KILLERBONE_FULL_URL + "friendship/" + String.valueOf(friendshipId) + "/accept/"
            + String.valueOf(userId);
}

From source file:Main.java

public static String formatBtiNum(int bignum) {
    try {//ww  w .  j ava2 s.com
        return String.format("%,d", bignum);
    } catch (Throwable e) {
    }
    return String.valueOf(bignum);
}

From source file:Main.java

public static String orderAlphabetically(String word) {
    char chars[] = word.toCharArray();
    Arrays.sort(chars);/*from w w  w.  ja  v a 2  s . com*/
    return String.valueOf(chars);
}

From source file:Main.java

private static String ordinal(int num) {
    String[] suffix = { "th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th" };
    int m = num % 100;
    return String.valueOf(num) + suffix[(m > 10 && m < 20) ? 0 : (m % 10)];
}

From source file:Main.java

public static int getAnioVigenciaPosition(String vigenciaAnio) {
    Calendar c = Calendar.getInstance();
    int anio = c.get(Calendar.YEAR);

    String anioInicial = String.valueOf(anio).substring(2, 4);
    int inicial = Integer.parseInt(anioInicial);
    int fin = Integer.parseInt(vigenciaAnio);

    return fin - inicial;
}

From source file:Main.java

public static String deletaDec(String de) {
    try {// www .  j av  a 2s .c om
        float tem = Float.parseFloat(de);
        return String.valueOf((int) tem);
    } catch (Exception e) {
        Log.i(LOG_TAG, "deletaDec exception : wind = " + de);
        return "0";
    }
}

From source file:Main.java

public static String getRandomNumString(int length) {
    StringBuilder builder = new StringBuilder();
    for (int i = 0; i < length; i++) {
        builder.append(String.valueOf((int) (Math.random() * 10)));
    }//  w ww  .ja v  a  2  s .  c o  m
    return builder.toString();
}

From source file:com.jaspersoft.jasperserver.search.model.SearchActionModelSupport.java

/**
 * Singleton getter method// www .  j  a  va  2 s . c o  m
 * @return singleton object
 */
public static synchronized SearchActionModelSupport getInstance(String searchMode) {
    SearchActionModelSupport.instance.setSearchMode(SearchMode.valueOf(searchMode.toUpperCase()));
    return SearchActionModelSupport.instance;
}