List of usage examples for java.text DecimalFormat setPositivePrefix
public void setPositivePrefix(String newValue)
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)); }