/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package lab12_calebfontenot;

/**
 *
 * @author caleb
 */
public class NestedForPyramid {
    public static void main(String[] args) {
        int startRight = 0, //Init decending numbers
            endSpace = 7;   //Init number of whitespaces to pad
            
            // PRIMARY FOR LOOP
            for (int row = 1; row <= 128; row += row) {
                //              Whitespace                  Moment
                for (int startSpace = 0; startSpace < endSpace; startSpace++) {
                    System.out.print("      ");
                }
                // Display ascending numbers
                for (int l = 1; l <= row; l += l) {
                    System.out.printf("%4d", (l));
                }
                // Display decending numbers
                for (int r = startRight; r > 0; r /= 2) {
                    System.out.printf("%4d", (r));
                }
                
                System.out.println();
                endSpace--;
                startRight = row;
            }
        
    }
}
