Java Format - Java DecimalFormat .setPositiveSuffix (String newValue)








Syntax

DecimalFormat.setPositiveSuffix(String newValue) has the following syntax.

public void setPositiveSuffix(String newValue)

Example

In the following code shows how to use DecimalFormat.setPositiveSuffix(String newValue) method.

import java.text.DecimalFormat;
/*from w  w w . j  av a  2  s. com*/
public class Main {
  public static void main(String[] argv) throws Exception {
    DecimalFormat format = new DecimalFormat();
    format.setPositiveSuffix("Positive");
    System.out.println(format.format(123456789.12345678));

  }
}

The code above generates the following result.