Java algorithm to make a straight pyramid [closed]

Solution 1:

This should do it:

public class Tower {
    public static void main(String[] args) {
        System.out.println("                 1                 ");
        System.out.println("               1 2 1               ");
        System.out.println("             1 2 3 2 1             ");
        System.out.println("           1 2 3 4 3 2 1           ");
        System.out.println("         1 2 3 4 5 4 3 2 1         ");
        System.out.println("       1 2 3 4 4 4 4 4 3 2 1       ");
        System.out.println("     1 2 3 3 3 3 3 3 3 3 3 2 1     ");
        System.out.println("   1 2 2 2 2 2 2 2 2 2 2 2 2 2 1   ");
        System.out.println(" 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ");
    }
}

Solution 2:

Try using a mono-spaced font like courier.