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 ReadableByteCount(long bytes) {
    int unit = 1024;
    if (bytes < unit)
        return bytes + " B";
    int exp = (int) (Math.log(bytes) / Math.log(unit));
    String pre = String.valueOf("KMGTPE".charAt(exp - 1));
    return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
}

From source file:com.rogers.ute.creditservice.util.CreditServiceUtils.java

private static void setIDValue(CreditEvaluationRequestInfoType creditEvaluationRequestInfoType,
        CreditCheckForm creditCheckForm, String idType, String identifierValue) {
    IDType idTypeEnum;/*from  w  w  w. j a  va  2  s. c  om*/
    try {
        idTypeEnum = IDType.valueOf(idType);
    } catch (IllegalArgumentException iae) {
        return;
    }

    switch (idTypeEnum) {
    case BIRTH_CERTIFICATE:
    case PASSPORT:
    case CITIZENSHIP:
    case OLD_AGE_CARD:
        creditEvaluationRequestInfoType.setOtherIDType(idTypeEnum.name());
        creditEvaluationRequestInfoType.setOtherIDNumber(identifierValue);
        break;

    case EMPLOYEE_ID:
        /*try {
            Employer employerTypeEnum = Employer.valueOf(creditCheckForm.getEmployer());
        }
        catch(IllegalArgumentException iae){
        }*/
        creditEvaluationRequestInfoType.setOtherIDType(idTypeEnum.name());
        creditEvaluationRequestInfoType.setOtherIDNumber(identifierValue);
        break;
    case CREDITCARD_NUMBER:
        creditEvaluationRequestInfoType.setCreditCardNumber(identifierValue);
        break;
    case DRIVER_LICENSE_NUMBER:
        creditEvaluationRequestInfoType.setDriverLicenseNumber(identifierValue);
        break;
    case SIN:
        creditEvaluationRequestInfoType.setSIN(identifierValue);
        break;
    }
}

From source file:Main.java

public static String addDateLesserSysTimeCondition(String conditions, String key) {
    if ((conditions == null) || (key == null) || (key == ""))
        return conditions;
    conditions = (new StringBuilder(String.valueOf(conditions))).append(" and to_date(").append(key)
            .append(",'yyyy-mm-dd')<(sysdate-1)").toString();
    return conditions;
}

From source file:Main.java

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

From source file:Main.java

public static String[] getMinute() {
    final int SIZE = 60;
    String[] minute = new String[SIZE];
    int index;/*from   w  w  w. j  ava2 s .  c o  m*/
    for (index = 0; index < SIZE; index++) {
        String indexValue = String.valueOf(index);
        if (indexValue.length() == 1) {
            indexValue = String.format("0%s", indexValue);
        }
        minute[index] = indexValue;
    }
    return minute;
}

From source file:Main.java

public static String addDateGreaterSysTimeCondition(String conditions, String key) {
    if ((conditions == null) || (key == null) || (key == ""))
        return conditions;
    conditions = (new StringBuilder(String.valueOf(conditions))).append(" and to_date(").append(key)
            .append(",'yyyy-mm-dd')>(sysdate-1)").toString();
    return conditions;
}

From source file:Main.java

private static String[] get12HourArray() {
    final int SIZE = 12;
    String[] hour = new String[SIZE];
    int index;//from  w  ww .  ja v a 2 s.  c  om
    for (index = 0; index < SIZE; index++) {
        String indexValue = String.valueOf(index);

        hour[index] = indexValue;
    }
    return hour;
}

From source file:Main.java

public static ArrayList<String> getXAxisValues(int dataSize) {

    ArrayList<String> xAxis = new ArrayList<>();

    for (int i = 0; i < dataSize; i++) {
        xAxis.add(String.valueOf(i + 1));
    }//w w  w  .j  a va2s.c  om
    return xAxis;
}

From source file:Main.java

public static String toMD5(String key) {
    String cacheKey;/*w w w. j  a  va  2s .  c o  m*/
    if (mDigest == null) {
        return String.valueOf(key.hashCode());
    }
    mDigest.update(key.getBytes());
    cacheKey = bytesToHexString(mDigest.digest());
    return cacheKey;
}

From source file:Main.java

public static String join(Collection<?> coll, String delimiter) {
    if (coll.isEmpty()) {
        return "";
    }//from w  ww . j  a  v a  2 s .c  om
    Iterator<?> it = coll.iterator();
    String s = String.valueOf(it.next());
    while (it.hasNext()) {
        s += delimiter;
        s += String.valueOf(it.next());
    }
    return s;
}