title: Drawing ASCII art using java
body: <p>I have a problem to draw a square ASCII with the size limit in 20 character (size of 'square'), this is my code, I've tested and it works but when I put the number more than 20 it's display an error, pls help, thanks.</p>
  
  <pre><code>class Main {
      public static void printSquare(int size) {
          int line = 1;
  
          while (line &lt;= size) { // For each line of square
              int width = size; // width of square segment
              int i = 1; // display square segment
  
              while (i &lt;= width &amp;&amp; size &lt;= 20) {
                  System.out.print("*");
                  i = i + 1;
              }
  
              System.out.println(); // Newline
              line = line + 1;
          }
      }
  }
  </code></pre>