title: Using ArrayList to get two dimensional array data
body: <p>My input is a text document grid of 0's and 1's, which i then put into a two dimensional integer array.</p>
  
  <p>The object for me is to "map" the 1's in the grid. I have to determine how many groups of 1's there are, how many each group has, and create a output text with the 1 groups labeled.</p>
  
  <p>for example i receive the following in text: </p>
  
  <pre><code>1 0 1 0 0 1 0
  1 1 1 0 1 1 0
  1 0 0 0 1 0 0
  0 0 1 0 0 0 1
  0 0 1 1 1 1 1
  </code></pre>
  
  <p>I would have three total groups, then have to spit it out like:</p>
  
  <pre><code>1 0 1 0 0 2 0
  1 1 1 0 2 2 0
  1 0 0 0 2 0 0
  0 0 3 0 0 0 3
  0 0 3 3 3 3 3 
  </code></pre>
  
  <p>As I'm doing my recursion, I created a two dimensional integer ArrayList to be expandable to groups and group members. I thought before that if i just changed all the "members" of the second group to 2's, then they should change in the original two dimensional Array because arrays are passed by reference.</p>
  
  <p>Am I wrong? Let me know if any additional information needs to be given too.</p>
  
  <p>Thanks in advance.</p>
  
  <p>Edit: if use the ArrayList.contains() function, it seems i have the problem that its looking if it contains an actual "1" not if it contains int[][] array[0][1] for example.</p>
  
  <p>Thanks!</p>