title: Need help centering text output
body: <pre><code>import java.util.Scanner;
  
  public class diamond {
      public static void main (String[] args){
  
          Scanner scan = new Scanner(System.in);
  
          System.out.println("Please enter an integer");
          int lines = scan.nextInt();
  
          for(int counter = 1; counter &lt;= lines; counter++)
          {   
              if (counter%2 != 0)
              {
                  for(int count2 = 1; count2 &lt;= counter; count2++){
                  System.out.print("*");
                  }
              System.out.println();
              }
          }
      }
  }
  </code></pre>
  
  <p>I am supposed to ask the user for a number of lines and output a diamond made of asterisks that number of lines tall.  I need some help figuring out how to center the asterisks.  I know for strings there is some String.utils method or something, but the output comes in pieces based on a for loop, so I don't think that really works here.  If it does, by all means let me know though.</p>