List of usage examples for java.text DecimalFormat DecimalFormat
public DecimalFormat(String pattern)
From source file:Main.java
public static void main(String[] argv) throws Exception { DecimalFormat df = new DecimalFormat("#%"); System.out.println(df.format(0.19)); System.out.println(df.format(-0.19)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DecimalFormat df = new DecimalFormat("#%"); System.out.println(df.format(0.19)); System.out.println(df.format(-0.19)); System.out.println(df.format(-0.009)); System.out.println(df.format(-12.009)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DecimalFormat formatter = new DecimalFormat("000E00"); String s = formatter.format(-1234.567); // -123E01 System.out.println(s);/*from w ww . ja va 2s . co m*/ }
From source file:Main.java
public static void main(String[] argv) { DecimalFormat formatter = new DecimalFormat("###E0"); String s = formatter.format(-1234.567); // -1.23E3 System.out.println(s);//from w w w . ja v a 2s .co m s = formatter.format(-123.4567); // -123E0 System.out.println(s); s = formatter.format(-12.34567); // -12.3E0 System.out.println(s); s = formatter.format(-1.234567); // -12.3E0 System.out.println(s); s = formatter.format(-.1234567); // -123E-3 System.out.println(s); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DecimalFormat formatter = new DecimalFormat("0.0E0"); String s = formatter.format(-1234.567); // -1.2E3 System.out.println(s);//from w w w . j av a 2 s. co m }
From source file:Main.java
public static void main(String[] argv) throws Exception { DecimalFormat formatter = new DecimalFormat("0000000000E0"); String s = formatter.format(-1234.567); // -1234567000E-6 System.out.println(s);// ww w . j av a2 s . c o m }
From source file:Main.java
public static void main(String[] argv) throws Exception { DecimalFormat formatter = new DecimalFormat("00E00"); String s = formatter.format(-1234.567); System.out.println(s);//from w w w.j av a 2 s.c o m }
From source file:Main.java
public static void main(String args[]) { double d = 0.12345; System.out.println(new DecimalFormat("0.#####E0").format(d)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DecimalFormat formatter = new DecimalFormat("00.00E0"); String s = formatter.format(-1234.567); // -12.35E2 System.out.println(s);/*from w w w .j a v a 2s.co m*/ s = formatter.format(-.1234567); // -12.35E-2 System.out.println(s); }
From source file:Main.java
public static void main(String[] argv) throws Exception { DecimalFormat formatter = new DecimalFormat("##E0"); String s = formatter.format(-1234.567); System.out.println(s);/* www. j av a 2s . com*/ s = formatter.format(-123.4567); System.out.println(s); s = formatter.format(-12.34567); System.out.println(s); }