Java Number Format Pattern toAccountantFormat(String str, int scale)

Here you can find the source of toAccountantFormat(String str, int scale)

Description

to Accountant Format

License

Open Source License

Declaration

public static String toAccountantFormat(String str, int scale) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {

    public static String toAccountantFormat(String str, int scale) {
        if (str != null) {
            String temp = "#,###,###,###,##0.";
            for (int i = 0; i < scale; i++) {
                temp += "0";
            }//from w ww  . j a v  a 2s .  co m
            return new java.text.DecimalFormat(temp).format(Double.valueOf(str));
        } else {
            return "0.00";
        }
    }
}

Related

  1. resetDecimalFormatByLocale(Locale locale)
  2. roundNumber(Number number, DecimalFormat format)
  3. stringFormat(BigDecimal value)
  4. stringToReais(String unformatted, boolean comSimbolo)
  5. strToFormatedNumber(String str)
  6. toDecimalFormat(BigDecimal value)
  7. toFormattedNumber(Object value)
  8. toNumber(String numString, String numFormatPattern)
  9. toNumberFormat(String input)