import java.util.Formatter; public class MainClass{ public static void main(String[] argv){ StringBuilder sb = new StringBuilder(); Formatter f = new Formatter(sb); int a = 1234; int b = 5; f.format("a = %7d and b = %-7d!!!", a, b); System.out.println(sb); } }
a = 1234 and b = 5 !!!