title: Pyramid Pattern in Java
body: <p>It was so hard to ask such a newbie question on this advanced site. But after so much tries and even loosing my hope i was forced to bring my self here. I am not been able to print the following pattern:</p>
  
  <pre><code>                    1                                                                                                                              
                  1   2   1   
              1   2   4   2   1   
          1   2   4   8   4   2   1   
      1   2   4   8   16  8   4   2   1
  1   2   4   8   16  32  16  8   4   2   1
  </code></pre>
  
  <p>But with my tiresome efforts i reached the following:</p>
  
  <pre><code>public static void main(String[] args) {
      int num = 1;
      for (int i = 0; i &lt; 15; i++) {
          for (int j = 0; j &lt; 15 - i; j++) {
              System.out.print(" ");
          }
          for (int k = 0; k &lt;= i; k++) {
              System.out.print(num + " ");
          }
          System.out.println();
      }
  }
  
  
             1 
            1 1 
           1 1 1 
          1 1 1 1 
         1 1 1 1 1 
        1 1 1 1 1 1 
       1 1 1 1 1 1 1 
      1 1 1 1 1 1 1 1 
     1 1 1 1 1 1 1 1 1 
    1 1 1 1 1 1 1 1 1 1 
   1 1 1 1 1 1 1 1 1 1 1 
  1 1 1 1 1 1 1 1 1 1 1 1 
  </code></pre>