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

StringformatDecimal(BigInteger b)
format Decimal
Locale loc = new Locale("nl", "NL", "EURO");
NumberFormat n = NumberFormat.getCurrencyInstance(loc);
double doublePayment = b.doubleValue();
n.setMaximumFractionDigits(0);
String s = n.format(doublePayment);
return s;
StringformatDecimalDisplay(final double _numberToFormat, final String _formatToApply)
Utility function for applying formatting to numbers.
String formattedNumber;
try {
    DecimalFormat decimalFormatForDisplay = new DecimalFormat(_formatToApply,
            new DecimalFormatSymbols(Locale.US));
    formattedNumber = decimalFormatForDisplay.format(_numberToFormat);
} catch (Exception e) {
    formattedNumber = new Double(_numberToFormat).toString();
return formattedNumber;
DoubleformatDouble(double in)
format Double
return Double.parseDouble(formatDoubleToString(in));
StringformatDouble(double inVal, int inDecs)
Formats a double value to specified number of decimal places runs through the internationalized NumberFormat, so may NOT do scientific notation
return formatDouble(inVal, inDecs, 14);
StringformatDouble(Double localDouble, int scale)
Formate un double
if (scale != formaterScale)
    initializeDecimalFormat(scale);
return decimalFormater.format(localDouble);
StringformatDouble(double number)
Formats double - show max 9 fraction digits
NumberFormat format = DecimalFormat.getInstance(Locale.US);
format.setMaximumFractionDigits(9);
format.setGroupingUsed(false);
return format.format(number);
StringformatDouble(double v)
Method to convert a double to a string.
return formatDouble(v, 3);
StringformatDouble(double val, String format)
format Double
final DecimalFormat formatter = new DecimalFormat(format, new DecimalFormatSymbols(Locale.ENGLISH));
return formatter.format(val);
StringformatDouble(Double valor, int decimal)
Formata um Double
if (valor == null) {
    return null;
NumberFormat format = NumberFormat.getInstance(new Locale("pt", "BR"));
format.setMaximumFractionDigits(decimal);
format.setMinimumFractionDigits(decimal);
return format.format(valor);
StringformatDouble(double value)
format Double
java.math.BigDecimal bigVal = new java.math.BigDecimal(value);
java.text.NumberFormat n = java.text.NumberFormat.getInstance(java.util.Locale.US);
String retString = n.format(value);
return retString;