Java tutorial
public class MainClass { public static void main(String args[]) { System.out.printf("%4d\n", 1); System.out.printf("%4d\n", 12); System.out.printf("%4d\n", 123); System.out.printf("%4d\n", 1234); System.out.printf("%4d\n\n", 12345); // data too large System.out.printf("%4d\n", -1); System.out.printf("%4d\n", -12); System.out.printf("%4d\n", -123); System.out.printf("%4d\n", -1234); // data too large System.out.printf("%4d\n", -12345); // data too large } }