How to Add Changing Variable Element to ArrayList in Java : <p>I have a need create an ArrayList to collect positions of some points.</p>

<pre><code>ArrayList&lt;int[]&gt;  collection =  new ArrayList&lt;int[]&gt; ;
//the position has 2 coordinations. 
int[] location = new int[2]
//add first position a,b
location[0] = a;
location[1] = b;
collection.add(location);
//add second position c,d
location[0] = c;
location[1] = d;
collection.add(location);
</code></pre>

<p>When I try to display the collection, all the elements inside are exactly the same as the last one was added (in this case: [c,d])</p>

<p>How do I add the element to my ArrayList properly in this case ? Thank you very much</p>
