Formating output using Formatter class is easy. It is some what like printf statement of C.

Java Code:
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:
Java Code:
Testing class java.util.Formatter: 
 Integer is 10 
 Float is 10.400000