List of usage examples for java.util Formatter Formatter
public Formatter()
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); fmt.format("%t", new Date()); System.out.println(fmt);//from w w w. j a v a 2s .co m }
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); fmt.format("%4d %4d %4d", 1, 2, 3); System.out.println(fmt);/*from ww w . j a v a 2 s. com*/ }
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); // Format to 2 decimal places in a 16 character field. fmt = new Formatter(); fmt.format("%16.2e", 123.1234567); System.out.println(fmt);//w w w . j a v a 2 s .c o m }
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);//from w w w. jav a 2s .c o m }
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); fmt.format("% d", -100); System.out.println(fmt);//from w ww. j a va2 s. c o 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(); // Display at most 15 characters in a string. fmt = new Formatter(); fmt.format("%.15s", "Formatting with Java is now easy."); System.out.println(fmt);/*from w w w . j a v a2 s . c om*/ }
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); Calendar cal = Calendar.getInstance(); fmt = new Formatter(); fmt.format("%h", cal); System.out.println(fmt);//from w w w .j av a 2 s . c o m }
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); // Display standard 12-hour time format. fmt.format("%tr", Calendar.getInstance()); System.out.println(fmt);//from w w w . java2 s. c o m }
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); Calendar cal = Calendar.getInstance(); fmt = new Formatter(); fmt.format("%tB %tb %tm", cal, cal, cal); System.out.println(fmt);//from w w w . j a v a 2s. c o m }
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); Calendar cal = Calendar.getInstance(); fmt.format("%tr", cal); System.out.println(fmt);//from w w w.j a v a2 s .c o m }