Java printing patterns : <p>I'm new in Java.
I have next code:</p>

<pre><code>public static void main(String[] args) {
        for(int k = 10; k &gt; 0; k--)
        {
            for(int l=0; l &lt; k-1; l++)
                {
                    System.out.print(' ');
                }
            for(int n=10; n &gt; k-1; n--)
                {
                    System.out.print('*');
                }
         System.out.println();
        } 
    }
</code></pre>

<p>It prints this:</p>

<pre><code>         *
        **
       ***
      ****
     *****
    ******
   *******
  ********
 *********
**********
</code></pre>

<p>But I want to print it with empty inside like this:</p>

<pre><code>         *
        **
       * *
      *  *
     *   *
    *    *
   *     *
  *      *
 *       *
**********
</code></pre>

<p>Can anyone to explane me how to do it.
I understand that this is not a place where solve homework tasks. But can somebody tell me the algorithm for solving the problem in words.
I do not need a ready solution because I want to understand and solve it by myself. So how I can put spaces inside?</p>
