Example usage for java.text DecimalFormat setPositivePrefix

List of usage examples for java.text DecimalFormat setPositivePrefix

Introduction

In this page you can find the example usage for java.text DecimalFormat setPositivePrefix.

Prototype

public void setPositivePrefix(String newValue) 

Source Link

Document

Set the positive prefix.

Usage

From source file:Main.java

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

}

From source file:Main.java

protected static final String encodingUTF8andSignPrefix(byte[] src, int srart, int length) throws Exception {
    byte[] b = new String(src, srart, length, "euc-kr").getBytes("utf-8");
    String str = new String(b).trim();
    str = str.substring(searchChar(str));
    DecimalFormat f = new DecimalFormat("###,###,###");
    f.setPositivePrefix("+");
    f.setNegativePrefix("-");
    return f.format(Double.parseDouble(str));
}