import java.util.Formatter; public class FormatterTest4 { public static void main(String[] args) { Formatter formatter = new Formatter((Appendable)System.out); int i = 1000; formatter.format("%%10d: [%10d]%n", i); formatter.format("%%-10d: [%-10d]%n%n", i); formatter.format("%%o: [%5o] %%x: [%5x] %%X: [%5X]%n", i, i, i); formatter.format("%%#o: [%#5o] %%#x: [%#5x] %%#X: [%#5X]%n%n", i, i, i); formatter.format("%%+d: [%+10d] %% d: [% d]%n", i, i); formatter.format("%%010d: [%010d] %%,d: [%,d]%n", i, i); formatter.format("%%d: [%d] %%(d: [%(d]%n%n", -i, -i); } }