How can I make a method do something a certain amount of times based on a parameter that is passed in?
<pre><code>public void printStars(int level) {

    for (int one = level; one &gt;= 1; one--) {

        for (int two = one; two &lt;= level; two++) {


            System.out.print("*");

        }
        System.out.println();


    }
}
</code></pre>

<p>I am trying to make something that looks like this:</p>

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

<p>Currently I am getting about half of the correct diagram all left aligned.</p>

<p>I tried to incorporate printf, but I realized that it wouldn't work because the value of <code>level</code> cannot be transferred to the printf method. I was also wondering if there was a way to set the longest segment (the bottom) equal to (2 * level) - 1 stars long and apply some sort of formatting on that to get the answer?</p>
