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("%.15s", "Formatting with Java is now easy."); System.out.println(fmt);//from ww w. j av a2s. c o m }
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); fmt.format("%.4f", 123.1234567); 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("|%-10.2f|", 123.123); System.out.println(fmt);/* 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(); fmt.format("Copying file%nTransfer is %d%% complete", 88); System.out.println(fmt);/*from w w w . j ava2 s . co m*/ }
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); fmt.format("%a", 123.123); System.out.println(fmt);//from w w w . j a v a2 s . c o m }
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); fmt.format("%05d", 88); System.out.println(fmt);/* ww w . ja v a 2 s .c o m*/ }
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); fmt.format("|%10.2f|", 123.123); System.out.println(fmt);/*from w w w .ja va 2s .c o m*/ }
From source file:Main.java
public static void main(String[] argv) throws Exception { Formatter fmt = new Formatter(); fmt.format("Default precision: %f\n", 10.0 / 3.0); fmt.format("Two decimal digits: %.2f\n\n", 10.0 / 3.0); System.out.println(fmt);//from 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(); fmt.format("%t", new Date()); System.out.println(fmt);/*from w w w .ja v a 2s .c om*/ }
From source file:MainClass.java
public static void main(String args[]) { Formatter fmt = new Formatter(); fmt.format("%E", 123.1234); System.out.println(fmt);//from w ww .j a v a2s . c om }