title: Why values in ArrayList always returns null as first value in Java?
body: <p>When i use this code to generate a random 5 card hand in Java, i get the correct result, but every line of cards is preceded by null. Why is that? For example, i get nullJ♥10♥8♥Q♦9♠, i tried some checks to prevent it, but to no avail. Please, if you have any suggestions, tell me what have I done wrong?</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Random;
  import java.util.Scanner;
  public class RandomHandGenerator {
      public static void main(String[] args) throws InterruptedException {
          Scanner input = new Scanner(System.in);
          int n = input.nextInt();
          String[]  faces = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"};
          char[] suits = {'♣', '♦', '♥', '♠'};
          ArrayList&lt;String&gt; deck = new ArrayList&lt;String&gt;();
          for (int i = 0; i &lt; suits.length; i++) {
              for (int j = 0; j &lt; faces.length; j++) {
                  String temp = faces[j] + suits[i];
                  deck.add(temp);
              }
          }
          int counter = 0;
          int generalCounter = 0;
          ArrayList&lt;String&gt; handsGenerated = new ArrayList&lt;String&gt;();
          while (generalCounter &lt; n) {    
              String[] currentHand = new String[5];
              Random generator;
              generator = new Random(); 
              //Ako ne se pusne edin Thread.sleep dava tvurde ednakvi karti:
              Thread.sleep(30);
              while (counter &lt; 5) {
                  int j = generator.nextInt(52);
                  String currentCard = deck.get(j);
                  if(!Arrays.asList(currentHand).contains(currentCard))   {
                      currentHand[counter] = currentCard;
                      counter++;
                  }  
              }
              String buildHand = null;
              for (int l = 0; l &lt; 5; l++) {
                  if (currentHand[l] != null) {
                      buildHand += currentHand[l];     
                  }                   
              }
              handsGenerated.add(buildHand);
              counter = 0;    
              generalCounter++;
              }
          for (int i = 0; i &lt; handsGenerated.size(); i++) {
              String displayHands = handsGenerated.get(i);
              System.out.println(displayHands);
          }
      }
  }
  </code></pre>