title: Correct reading of a txt in arrayList
body: <p>I'm studying JAVA and I have an input txt file that has the following format:</p>
  <pre><code>Samuel 0 1 1 0 0 1 0 1 0 1 0 1
  Nicole 0 0 0 1 1 0 1 0 1 0 1 0
  Josiah 0 2 2 2 2 1 2 1 2 1 2 1
  Mario 0 0 1 1 1 1 1 1 1 1 1 1
  </code></pre>
  <p>I have a Bet class that says that a bet has a NAME and an ARRAYLIST with its bets, so I need to extract this information from the TXT for the object.</p>
  <pre><code>public class Bet {
  
  public ArrayList arrayBets = new ArrayList(12);
  private String name;
  </code></pre>
  <p>I created the following method:</p>
  <pre><code>while((line = br.readLine()) != null) {
  arrayTotal Bets.add(new Bet());
  String[] strings = line.split(&quot;\\s+&quot;);
  arrayTotalBets.get(j).setName(strings[0]);
  
  for(int i = 1; i &lt; arrayTotalBets.get(j).arrayBets.size(); i++) {
  int foo = Integer.parseInt(strings[i]);
  arrayTotalBets.get(j).arrayBets.set(i-1, foo);
  }
  j++;
  }
  </code></pre>
  <p>I'm managing to split between the name and the integers.</p>
  <p>So in this same class I created a for to write what I just read.</p>
  <pre><code>for(int g = 0; g &lt; arrayTotalBets.size(); g++) {
  System.out.println(arrayTotalBets.get(g).getName());
  for (int l=0; l&lt;arrayTotalBets.get(g).arrayBets.size();l++) {
  System.out.print(arrayTotalBets.get(g).arrayBets.get(l));
  }
  }
  </code></pre>
  <p>This method is just writing:</p>
  <pre><code>Samuel
  Nicole
  Josiah
  mario
  </code></pre>
  <p>Which leads me to believe that I am not being able to correctly insert the integers in the ArrayList.</p>
  <p>Where is my split wrong?</p>