Java Format - Java DecimalFormat .setDecimalFormatSymbols (DecimalFormatSymbols newSymbols)








Syntax

DecimalFormat.setDecimalFormatSymbols(DecimalFormatSymbols newSymbols) has the following syntax.

public void setDecimalFormatSymbols(DecimalFormatSymbols newSymbols)

Example

In the following code shows how to use DecimalFormat.setDecimalFormatSymbols(DecimalFormatSymbols newSymbols) method.

//w w  w. j  a v  a 2 s .  co  m

import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;

public class Main{
  public static void main(String[] argv) {
    DecimalFormat df = (DecimalFormat) NumberFormat.getInstance();
    DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();

    dfs.setZeroDigit('\u0660');
    df.setDecimalFormatSymbols(dfs);

    System.out.println(df.format(1234567.89));
  }
}

The code above generates the following result.