Java Format - Java DecimalFormat .setNegativeSuffix (String newValue)








Syntax

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

public void setNegativeSuffix(String newValue)

Example

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

import java.text.DecimalFormat;
//from  w  w  w  .  j av a2s . c o  m
public class Main {
  public static void main(String[] argv) throws Exception {
    DecimalFormat format = new DecimalFormat();
    format.setNegativeSuffix("minus");
    System.out.println(format.format(-123456789.12345678));

  }
}

The code above generates the following result.