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

StringformatFloat(float f, int numDecPlaces, boolean forceFractions)
Formats the given float to a String with the specified number of decimal places.
return (formatFloat(f, numDecPlaces, forceFractions, false));
StringformatFloat(Float f, int style)
format Float
String num = new String("0");
if (f != null)
    num = new String(f.toString());
else
    return "";
NumberFormat nf = null;
switch (style) {
case FORMAT_INTEGER: {
...
StringformatFloat(float val)
Formats a float to String and prevents scientific notation
return FLOAT_FMT.format(new Object[] { new Float(val) });
StringformatFraction2(final Number value)
format Fraction
final Locale locale = Locale.getDefault();
final NumberFormat format = getNumberFraction2Format(locale);
return format.format(value);
StringformatInCurrentDefaultLocale(double d)
format In Current Default Locale
return format(d, java.text.NumberFormat.getNumberInstance());
ObjectformatingDecimalNumber(Object obj, Locale locale, int maxIntPart, int maxFloatPart)
formatting the object (obj) to a bigDecimal taking into account the locale
Object result = obj;
NumberFormat numberFormat = settingUpValuesOfFormat(locale, maxIntPart, maxFloatPart);
try {
    Double number = new Double(obj.toString());
    result = numberFormat.format(number.doubleValue());
} catch (NumberFormatException e) {
return result;
...
StringformatInt(final int number)
Format the given int to a int with ,'s in it.
final NumberFormat formater = NumberFormat.getInstance(Locale.UK);
return formater.format(number);
StringformatInteger(int input)
format Integer
NumberFormat formatter = NumberFormat.getInstance(new Locale("en_US"));
return formatter.format(input);
StringformatInteger(Long num)
format Integer
return NumberFormat.getInstance(Locale.US).format(num.longValue());
StringformatIntWithCommas(int num)
format Int With Commas
return NumberFormat.getNumberInstance(Locale.US).format(num);