title: How to make a pyramid using astersik in Java?
body: <p>Good day guys! So I'm self learning java right now. And one of the exercises I'm answering now is creating a program Pyramid.java that takes an input N and prints a 
  pyramid whose each side is of length N, like the one below: My problem is that everytime I put an input on the command line, the 3 asterisk in the middle don't appear.</p>
  
  <pre><code>    *
     * *
    * * *
   * * * *
  * * * * *
  </code></pre>
  
  <p>Here's my code</p>
  
  <pre><code> public class D2Q6 {
  
   public static void main(String[] args) {
      int N = Integer.parseInt(args[0]);
      int k = 1;
      for(int i = 1; i &lt;= N; i++) {
          for(int j = 0; j &lt; N-i; j++)
              System.out.print(" ");
          System.out.print("*");
          if(i &gt; 1) {
              if(i == N) {
                  for(int j = 0; j &lt; i-1; j++)
                      System.out.print(" *");
              }
              else {
                  for(int j = 0; j &lt; k; j++)
                      System.out.print(" ");
                  k = k+2;
                  System.out.print("*");
              }
          }
          System.out.println();
      } 
  }
  </code></pre>