java nested loop logic for triangle's left side
<p>Okay I am so tired of struggling with this and right off the bat I feel really stupid so please be gentle.. I've searched the stack overflow and web and still not finding anything.  I am using a nested loop to create a triangle that looks like this:</p>

<pre><code>              1
          1   2   1
      1   2   4   2   1
  1   2   4   8   4   2   1
</code></pre>

<p>...etc. through 128 in the center column.</p>

<p>My loop for the left side renders to the right of my triangle instead of to the left. I'm pretty sure that after I receive an answer I will be hitting my head w/the palm of my hand and saying duh repeatedly. Anyway thanks for your help. I especially want an explanation of the logic. Here is the code.</p>

<pre><code>public class Pyramid_center_x2_0519 {

public static void main(String[] args) {

    for (int centerColumn = 1; centerColumn &lt;= 128; centerColumn *=2){
        for (int j = 8; j &gt; 1; j--) {
            System.out.printf("%7s", "");
        }

        for (int rightSide = centerColumn; rightSide &gt; 0; rightSide/=2){

            System.out.printf("%7d", rightSide);
        }

        for (int leftSide = 2; leftSide &lt; centerColumn; leftSide*=2){

            System.out.print( leftSide );           
        }

        System.out.println("");
    }
 }
}
</code></pre>

<p>Here is the way it renders:
<a href="https://i.stack.imgur.com/XYaJg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XYaJg.jpg" alt="enter image description here"></a></p>

<p>Thanks again.......</p>

<p>UPDATED CODE 12 P.M. 5-31-16: I understand Java prints left to right.  Below I have placed the left hand loop before the right side loop but my spacing in front of the triangle is not behaving. Thank you all... again</p>

<pre><code>    for (int centerColumn = 1; centerColumn &lt;= 128; centerColumn *=2){
        for (int j = 8; j &gt; 0; j--) {

            System.out.printf("%7s", "");
        }
        for (int leftSide = 1; leftSide &lt; centerColumn; leftSide*=2){

            System.out.print( leftSide );           
        }
        for (int rightSide = centerColumn; rightSide &gt; 0; rightSide/=2){

            System.out.printf("%7d", rightSide);
        }

        System.out.println("");
    }
}
</code></pre>

<p>}</p>