title: getting floats rather than objects out of an Arraylist
body: <p>I am trying to create a method that removes duplicates from a 2d array. the outside array conains point indexes and the inner array contains their coordinates. It looks like i have to use an arraylist in order to remove elements without ending up with null values in the array. I would then like to convert the arraylist back into a 2D array in order to return it in the format i require. The problem is that the arraylsit contains an array of objects so i can't cast it into an array designed for floats. what is the correct syntax for filtering the floats from my array list. my code follows:</p>
  
  <pre><code>public class rem_duplicates {
      public float [][] rem_geo_duplicates(float a[][]){
  
          ArrayList&lt;float[]&gt; al = new ArrayList&lt;float[]&gt;();
          float no_points = a.length;
          int count = 0;
  
  
          for (int i = 0; i &lt; no_points-1; i++){
              if((a[i][0] == a[i+1][0])&amp;&amp;(a[i][1] == a[i+1][1])){
                      a[i] = null;
                      count ++;
              }
  
          for (int j = 0; j &lt; no_points; j++){
              if (a[j] != null){
                  al.add(a[j]);       
              }
          }
  
          //how do i get the arraylist 'al' into this array b[][]?
          float b[][] = new float [a.length-count][3];
          b = al.toArray();
  
  
          }
  
      }
      return b
  }
  </code></pre>