title: java print text with square/frame of *
body: <p>I am trying to figure out how to print text wrapped with a 80x80 square of *.</p>
  
  <p>My code so far:</p>
  
  <pre><code>Scanner scanner = new Scanner(System.in);
      String text = scanner.next();
  
      int square = 80;
  
      if(square &gt; 0){
          for(int i = 0; i&lt;square; i++){
              for(int j = 0; j&lt;square; j++){
                  if(i == 0 || j == 0 || i == square-1 || j == square-1)
                      System.out.print("*");
                  else
                      System.out.print(" ");
              }
              System.out.println();
          }
      }
  </code></pre>
  
  <p>However I cant figure out how to put the text in the square, any ideas? The frame/square must always be 80x80 *'s even if the text is longer.</p>