Formating output using Formatter class is easy. It is some what like printf statement of C.
Formatter fmt = new Formatter();
fmt.format("Testing %s: %n %s is %d %n %s is %f",
fmt.getClass(),"Integer", 10, "Float", 10.4);
System.out.println(fmt);
Output:
Testing class java.util.Formatter:
Integer is 10
Float is 10.400000