List of usage examples for java.text DecimalFormat DecimalFormat
public DecimalFormat(String pattern)
From source file:Main.java
public static void main(String args[]) { System.out.println(new DecimalFormat("000000E0").format(123123)); }
From source file:Main.java
public static void main(String args[]) { System.out.println(new DecimalFormat("0.#####E0").format(123456)); }
From source file:Main.java
public static void main(String args[]) { DecimalFormat df = new DecimalFormat("0000000000000000"); String z = df.format(123456); System.out.println(z);/*w ww.j a v a 2 s.co m*/ }
From source file:Main.java
public static void main(String[] args) { DecimalFormat df = new DecimalFormat("0.00"); long freeMem = Runtime.getRuntime().freeMemory(); System.out.println(df.format(freeMem / 1000000F) + " MB"); }
From source file:Main.java
public static void main(String[] args) { DecimalFormat df = new DecimalFormat("0.###"); double[] tests = { 2.50, 2.0, 1.3751212, 2.1200 }; for (double d : tests) { System.out.println(df.format(d)); }//from w w w . j a v a 2 s. c o m }
From source file:Main.java
public static void main(String[] args) { DecimalFormat df = new DecimalFormat("0.00"); long maxMem = Runtime.getRuntime().maxMemory(); System.out.println(df.format(maxMem / 1000000F) + " MB"); }
From source file:Main.java
public static void main(String args[]) { System.out.println(new DecimalFormat("0.######E0").format(12345)); }
From source file:Main.java
public static void main(String[] args) { DecimalFormat df = new DecimalFormat("0.00"); long totalMem = Runtime.getRuntime().totalMemory(); System.out.println(df.format(totalMem / 1000000F) + " MB"); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DecimalFormat df = new DecimalFormat("#,.00;(#,.00)"); System.out.println(df.format(7123.00)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DecimalFormat df = new DecimalFormat("\u00a4#,##0.00"); System.out.println(df.format(4232.19)); System.out.println(df.format(-4232.19)); }