Java DecimalFormat .setPositivePrefix (String newValue)

Syntax

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

public void setPositivePrefix(String newValue)

Example

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


/*from   ww w . ja v  a2  s.  c om*/
import java.text.DecimalFormat;

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

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.text »




DateFormat
DecimalFormat
NumberFormat
SimpleDateFormat