title: How to convert this while loop into recursion?
body: <p><a href="http://www.cs.millersville.edu/~hutchens/cs162/recursion.html" rel="nofollow">I'm trying to solve this problem but in stuck in converting my while loop into recursion </a><br>
  Ive managed to implement the printMany function as follows  </p>
  
  <pre><code>public static void printMany(int count, String s){  
    if(count &gt;= 1) {
      System.out.print(s);
      printMany(count-1, s);
    }
  }   
  </code></pre>
  
  <p>But the current implementation of the hourglass method still uses loops though it displays the correct output.  </p>
  
  <pre><code>public static void hourglass(int numberOfStars, int numberOfSpaces){
    while(numberOfStars&gt;0){
      printMany(numberOfSpaces++, " ");
      printMany(numberOfStars--, "X ");
      System.out.println();
    }  
  
    numberOfSpaces -=2;;
    numberOfStars += 2;
  
    while(numberOfSpaces&gt;=0){
      printMany(numberOfSpaces--, " ");
      printMany(numberOfStars++, "X ");
      System.out.println(); 
    }
  }  
  </code></pre>
  
  <p>I want to ask, how can I convert this while loop into a recursive call? </p>