Java Utililty Methods Locale Format

List of utility methods to do Locale Format

Description

The list of methods to do Locale Format are organized into topic(s).

Method

StringformatDouble(double value)
format Double
return DOUBLE_FORMATTER.format(value);
StringformatDouble(final Double value)
format Double
return FORMATTER.format(value);
StringformatDouble(Locale locale, double value)
format Double
NumberFormat numberFormat = NumberFormat.getInstance(locale);
return numberFormat.format(value);
StringformatDouble(Number value)
format Double
if (value == null) {
    return "0";
return doubleFormat.format(value);
StringformatDouble(String pattern, double value)
format Double
Locale currentLocale = Locale.getDefault();
NumberFormat nf = NumberFormat.getNumberInstance(currentLocale);
DecimalFormat df = (DecimalFormat) nf;
df.applyPattern(pattern);
return df.format(value);
StringformatDoubleToCSV(double d)
format Double To CSV
return format.format(d).replaceAll(frenchSpace, "");
StringformatDuration(long nanoTime)
format Duration
double seconds = nanoTime / 1.0e9;
DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.US);
DecimalFormat formatter = new DecimalFormat("0.000", symbols);
return formatter.format(seconds);
StringformatedDate(Date date)
format date into my locale
if (date == null) {
    date = new Date();
return dateFormatter.format(date);
StringformatElapsedTime(double runTime)
format Elapsed Time
NumberFormat numberFormat = NumberFormat.getInstance(Locale.ENGLISH);
return numberFormat.format(runTime / MS_PER_SEC);
StringformatEn(T date, String pattern)
format En
if (date == null)
    return null;
try {
    SimpleDateFormat df = new SimpleDateFormat(pattern, Locale.ENGLISH);
    String result = df.format(date);
    return result;
} catch (Exception e) {
    return null;
...