Java Utililty Methods Decimal Format

List of utility methods to do Decimal Format

Description

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

Method

StringgetDecimalFormat(String format, String sNumber)
get Decimal Format
DecimalFormat nf = new DecimalFormat(format);
return nf.format((long) Integer.parseInt(sNumber));
DecimalFormatgetDecimalFormat(String pattern)
get Decimal Format
DecimalFormatSymbols symbols = new DecimalFormatSymbols();
symbols.setDecimalSeparator('.');
DecimalFormat format = new DecimalFormat(pattern);
format.setDecimalFormatSymbols(symbols);
return format;
DecimalFormatgetDecimalFormatFix1()
get Decimal Format Fix
if (decFmtFix1 == null) {
    NumberFormat numFmt = NumberFormat.getNumberInstance();
    if (numFmt instanceof DecimalFormat) {
        decFmtFix1 = (DecimalFormat) numFmt;
    } else {
        decFmtFix1 = new DecimalFormat();
    decFmtFix1.applyPattern("###,##0.0");
...
DecimalFormatSymbolsgetDecimalFormatSymbols(Locale locale)
get Decimal Format Symbols
DecimalFormatSymbols symbols = (DecimalFormatSymbols) symbolsCache.get(locale);
if (symbols == null) {
    symbols = new DecimalFormatSymbols(locale);
    symbolsCache.put(locale, symbols);
return symbols;
DecimalFormatSymbolsgetDecimalFormatSymbols(final Locale locale)
get Decimal Format Symbols
DecimalFormatSymbols symbol;
if (locale != null) {
    symbol = DecimalFormatSymbols.getInstance(locale);
} else {
    symbol = DecimalFormatSymbols.getInstance();
return symbol;
StringgetDecimalFormattedNoQuote(String englishFormat)
get Decimal Formatted No Quote
return englishFormat.replace('.', getDecimalSeparator());
NumberFormatgetDecimalFormatter()
get Decimal Formatter
NumberFormat format = DecimalFormat.getNumberInstance();
format.setMinimumFractionDigits(1);
format.setMaximumFractionDigits(1);
return format;
NumberFormatgetDecimalFormatter(int scale)
Obtin un formatter pentru o anumita scara
if (scale != formaterScale)
    initializeDecimalFormat(scale);
return decimalFormater;
intgetDigitNumber(double p)
get Digit Number
NumberFormat formatter = new DecimalFormat();
formatter = new DecimalFormat("0.######E0");
String s = formatter.format(p);
String ss = s.substring(s.indexOf("E") + 1);
return Integer.parseInt(ss);
StringgetDoubleAsString(double value)
get Double As String
if (value % 1 != 0) {
    return String.valueOf(value);
} else {
    return decimalFormat.format(value);