List of usage examples for java.text DecimalFormat format
public final String format(double number)
From source file:Main.java
public static void main(String[] argv) throws Exception { DecimalFormat format = new DecimalFormat(); format.setNegativeSuffix("minus"); System.out.println(format.format(-123456789.12345678)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DecimalFormat format = new DecimalFormat(); format.setNegativePrefix("minus"); System.out.println(format.format(-123456789.12345678)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DecimalFormat format = new DecimalFormat("##.##", DecimalFormatSymbols.getInstance()); System.out.println(format.format(-123456789.12345678)); }
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
public static void main(String[] argv) throws Exception { DecimalFormat format = new DecimalFormat(); format.setPositiveSuffix("Positive"); System.out.println(format.format(123456789.12345678)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DecimalFormat format = new DecimalFormat(); format.applyLocalizedPattern("##,##"); System.out.println(format.format(-123456789.12345678)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DecimalFormat format = new DecimalFormat(); format.setMinimumIntegerDigits(4);/* ww w .j av a 2 s . co m*/ System.out.println(format.format(123456789.12345678)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DecimalFormat format = new DecimalFormat(); format.setMaximumFractionDigits(4);/*from ww w .j av a2 s. c om*/ System.out.println(format.format(123456789.12345678)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DecimalFormat format = new DecimalFormat(); format.setMinimumFractionDigits(4);/* ww w .j av a 2 s .com*/ System.out.println(format.format(123456789.12345678)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DecimalFormat format = new DecimalFormat(); format.setDecimalSeparatorAlwaysShown(false); System.out.println(format.format(123456789.12345678)); }