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:gov.nih.nci.rembrandt.web.ajax.DynamicListHelper.java

public static String getGenericListAsList(String listType) {
    return CommonListFunctions.getListAsList(ListType.valueOf(listType));
}

From source file:Main.java

public static String cutPreAndLowerFirst(String str, int preLength) {
    if (str == null) {
        return null;
    }/*from   w ww.  ja  va  2 s .c  o m*/
    if (str.length() > preLength) {
        char first = Character.toLowerCase(str.charAt(preLength));
        if (str.length() > preLength + 1) {
            return first + str.substring(preLength + 1);
        }
        return String.valueOf(first);
    }
    return null;
}

From source file:Main.java

public static String attributeToString(float att, float bad_Value) {
    return (att == bad_Value ? "?" : String.valueOf(att));
}

From source file:Main.java

public static int getLinkSpeedMax(Context context) {
    /**//w  w  w.j  a  va2  s .co  m
     * Mbps
     */
    WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
    WifiInfo wi = wm.getConnectionInfo();
    Log.v("getLinkSpeed", String.valueOf(wi.getLinkSpeed()));
    return wi.getLinkSpeed();
}

From source file:Main.java

public static String toString(Collection coll, String delim) {
    StringBuffer sb = new StringBuffer();
    for (Iterator it = coll.iterator(); it.hasNext();) {
        Object obj = it.next();/*from  ww w  .j  a v  a 2 s .c  o  m*/
        sb.append(String.valueOf(obj));
        if (it.hasNext()) {
            sb.append(delim);
        }
    }
    return sb.toString();
}

From source file:Main.java

public static String encodeUrl(String inputUrl) {

    if (isBlank(inputUrl))
        return inputUrl;

    char[] charArray = inputUrl.toCharArray();
    for (int i = 0; i < charArray.length; i++) {
        if ((charArray[i] >= 0x4e00) && (charArray[i] <= 0x9fbb)) {
            inputUrl = inputUrl.replaceFirst(String.valueOf(charArray[i]),
                    URLEncoder.encode(String.valueOf(charArray[i])));

        }//  w ww .  j a  va  2 s  .com
    }
    return inputUrl;
}

From source file:Main.java

public static String formatByte(long l) {
    String s = "0 KB";
    if (l <= 0x100000L) {
        BigDecimal bigdecimal = new BigDecimal(l);
        BigDecimal bigdecimal1 = new BigDecimal(1024);
        RoundingMode roundingmode = RoundingMode.CEILING;
        String s1 = String.valueOf(bigdecimal.divide(bigdecimal1, 0, roundingmode).toString());
        s = (new StringBuilder(s1)).append(" KB").toString();
    } else {//from  w  w w  .  j  av a  2  s  .c  o  m
        if (l >= 0x40000000L) {
            BigDecimal bigdecimal2 = new BigDecimal(l);
            BigDecimal bigdecimal3 = new BigDecimal(0x40000000);
            RoundingMode roundingmode1 = RoundingMode.CEILING;
            String s2 = String.valueOf(bigdecimal2.divide(bigdecimal3, 2, roundingmode1).toString());
            s = (new StringBuilder(s2)).append(" G").toString();
        } else {
            BigDecimal bigdecimal4 = new BigDecimal(l);
            BigDecimal bigdecimal5 = new BigDecimal(0x100000);
            RoundingMode roundingmode2 = RoundingMode.CEILING;
            String s3 = String.valueOf(bigdecimal4.divide(bigdecimal5, 2, roundingmode2).toString());
            s = (new StringBuilder(s3)).append(" MB").toString();
        }
    }
    return s;
}

From source file:Main.java

public static String zeroOne(int second) {
    if (second < 10) {
        return "0" + second;
    }//from  w  w w . j  a v a2s . co  m
    return String.valueOf(second);
}

From source file:Main.java

public static int daysBetween(java.sql.Date date1, java.sql.Date date2) {
    Calendar cal = Calendar.getInstance();
    cal.setTime(date1);//from  www  . j av  a  2s .  c o  m
    long time1 = cal.getTimeInMillis();
    cal.setTime(date2);
    long time2 = cal.getTimeInMillis();
    long between_days = (time2 - time1) / (1000 * 3600 * 24);

    return Integer.parseInt(String.valueOf(between_days));
}

From source file:Main.java

public static <T> T checkNotNull(T reference, @Nullable Object errorMessage) {
    if (reference == null) {
        throw new NullPointerException(String.valueOf(errorMessage));
    } else {//from w  w  w.  ja  v a 2 s  . c om
        return reference;
    }
}