Java DecimalFormat.toPattern()

Syntax

DecimalFormat.toPattern() has the following syntax.

public String toPattern()

Example

In the following code shows how to use DecimalFormat.toPattern() method.


/*from  w  ww  .j  av  a  2s.  com*/
import java.text.DecimalFormat;

public class Main {
  public static void main(String[] argv) throws Exception {
    DecimalFormat format = new DecimalFormat();
    
    System.out.println(format.toPattern());

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.text »




DateFormat
DecimalFormat
NumberFormat
SimpleDateFormat