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 generateFileName() {
    // create a random file
    String name = String.valueOf(System.currentTimeMillis());
    return Environment.getExternalStorageDirectory() + "/" + ALBUM_THUMB_FOLDER + "/" + name;
}

From source file:com.datascience.hadoop.CsvOutputFormat.java

/**
 * Creates a CSV format from a Hadoop configuration.
 *///w  ww  . ja va2s.  c om
private static CSVFormat createFormat(Configuration conf) {
    CSVFormat format = CSVFormat
            .newFormat(conf.get(CSV_WRITER_DELIMITER, DEFAULT_CSV_WRITER_DELIMITER).charAt(0))
            .withSkipHeaderRecord(conf.getBoolean(CSV_WRITER_SKIP_HEADER, DEFAULT_CSV_WRITER_SKIP_HEADER))
            .withRecordSeparator(conf.get(CSV_WRITER_RECORD_SEPARATOR, DEFAULT_CSV_WRITER_RECORD_SEPARATOR))
            .withIgnoreEmptyLines(
                    conf.getBoolean(CSV_WRITER_IGNORE_EMPTY_LINES, DEFAULT_CSV_WRITER_IGNORE_EMPTY_LINES))
            .withIgnoreSurroundingSpaces(conf.getBoolean(CSV_WRITER_IGNORE_SURROUNDING_SPACES,
                    DEFAULT_CSV_WRITER_IGNORE_SURROUNDING_SPACES))
            .withNullString(conf.get(CSV_WRITER_NULL_STRING, DEFAULT_CSV_WRITER_NULL_STRING));

    String[] header = conf.getStrings(CSV_WRITER_COLUMNS);
    if (header != null && header.length > 0)
        format = format.withHeader(header);

    String escape = conf.get(CSV_WRITER_ESCAPE_CHARACTER, DEFAULT_CSV_WRITER_ESCAPE_CHARACTER);
    if (escape != null)
        format = format.withEscape(escape.charAt(0));

    String quote = conf.get(CSV_WRITER_QUOTE_CHARACTER, DEFAULT_CSV_WRITER_QUOTE_CHARACTER);
    if (quote != null)
        format = format.withQuote(quote.charAt(0));

    String quoteMode = conf.get(CSV_WRITER_QUOTE_MODE, DEFAULT_CSV_WRITER_QUOTE_MODE);
    if (quoteMode != null)
        format = format.withQuoteMode(QuoteMode.valueOf(quoteMode));
    return format;
}

From source file:Main.java

public static void debug(Object output) {
    if (DEBUG) {
        Log.d("AML", String.valueOf(output));
    }
}

From source file:Main.java

private static int calculateSum(char[] c, byte[] weight) {
    int res = 0;/*  w  w  w  . j a v a  2 s  .c om*/
    for (int i = 0; i < c.length; i++) {
        res += (alphaMap.get(String.valueOf(c[i])) % 10) * weight[i];
    }

    res %= 11;

    return res;
}

From source file:Main.java

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

From source file:Main.java

public static String getTimeStamp() {
    try {/*from   w  w w. ja  v a  2s.  c  o m*/
        //            SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS", Locale.getDefault());
        //            return df.format(new Date());
        return String.valueOf(System.currentTimeMillis());
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

From source file:Main.java

public static String getTimeFormat(long totaltime) {
    int hour = (int) (totaltime / 3600);
    int leftH = (int) (totaltime % 3600);
    int min = leftH / 60;
    int sec = leftH % 60;
    String hourTxt = hour > 9 ? String.valueOf(hour) : ("0" + hour);
    String minTxt = min > 9 ? String.valueOf(min) : ("0" + min);
    String secTxt = sec > 9 ? String.valueOf(sec) : ("0" + sec);
    return hourTxt + ":" + minTxt + ":" + secTxt;
}

From source file:Main.java

public static String GetSpinnerValue(Spinner sp) {

    if (sp.getVisibility() == View.VISIBLE) {
        Log.e("Error in Get Spinner : ", String.valueOf(sp.getId()));
        return ((sp).getSelectedItem().toString().substring(0,
                (sp).getSelectedItem().toString().lastIndexOf(":"))).trim();

    } else {/*from  ww  w .  j  a v a2  s  .c  om*/
        return "";
    }
}

From source file:com.nortal.petit.core.util.SqlSearchUtil.java

public static String formatSearchPattern(String pattern, String searchType) {
    if (!EnumUtils.isValidEnum(SearchType.class, searchType)) {
        throw new IllegalArgumentException("Unsupported search type: " + searchType);
    }//from   w w  w. j  a  v a 2 s  . c  o  m
    return formatSearchPattern(pattern, SearchType.valueOf(searchType));
}

From source file:Main.java

public static String deviceResolution(Context c) {
    DisplayMetrics metrics = c.getResources().getDisplayMetrics();
    return String.valueOf(metrics.widthPixels) + "x" + metrics.heightPixels;
}