title: How to print ArrayList into rows and columns?
body: <p>I have an arraylist of 52 playing cards. I want to print them out <a href="https://i.stack.imgur.com/WWMWD.png" rel="nofollow noreferrer">into 4 rows and 13 columns like this.</a>
  Right now, I only know how to print them all out in a straight line like <a href="https://i.stack.imgur.com/n0z64.png" rel="nofollow noreferrer">this</a>.</p>
  
  <p>This is how I construct my arraylist:</p>
  
  <pre><code>    private static void deckOfCards(ArrayList&lt;PlayingCard&gt; cardList)
      {           
          for(SuitEnum s : SuitEnum.values())
          {       
              for(RankEnum r: RankEnum.values())
              {
                  cardList.add(new PlayingCard(s, r));
              }
          }           
      }
  </code></pre>
  
  <p>My current method to display the all the playing cards:</p>
  
  <pre><code>    private static void displayCards(ArrayList&lt;PlayingCard&gt; cardList)
      {
          for(PlayingCard p : cardList)
          {
              System.out.print(p);
          }   
      }
  </code></pre>
  
  <p>How do I print the cards nicely into 4 rows and 13 columns? Thanks.</p>