List of usage examples for java.util Formatter format
public Formatter format(String format, Object... args)
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); fmt.format("%(d", -100); System.out.println(fmt);// www. java2 s .c om }
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); fmt.format("%,.2f", 4356783497.34); System.out.println(fmt);/* w w w . ja va 2 s.c o m*/ }
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); fmt.format("%X", 250); System.out.println(fmt);//from w w w . j av a2 s . com }
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); fmt.format("%#x", 1); System.out.println(fmt);/* w ww . j a va2s .c o m*/ }
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); fmt.format("%05d", 100); System.out.println(fmt);// w ww. ja va 2 s . c o m }
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); fmt.format("%#e", 1F); System.out.println(fmt);//from w ww . j a va2 s . c om }
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); fmt.format("%#o", 1); System.out.println(fmt);// ww w. j a va 2s . com }
From source file:Main.java
public static void main(String[] argv) throws Exception { Formatter fmt = new Formatter(); fmt.format("No group separators: %d\n", 123456789); fmt.format("With group separators: %,d\n\n", 123456789); System.out.println(fmt);// ww w .j a va 2 s. c om }
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); fmt.format("% d", -100); System.out.println(fmt);//from ww w . ja v a 2 s . co m fmt = new Formatter(); fmt.format("% d", 100); System.out.println(fmt); fmt = new Formatter(); fmt.format("% d", -200); System.out.println(fmt); fmt = new Formatter(); fmt.format("% d", 200); System.out.println(fmt); }
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); // left justify. fmt.format("|%-10.2f|", 123.123); System.out.println(fmt);//ww w.j av a 2s .com }