title: cannot convert ArrayList<Integer> to int[]
body: <pre><code>import java.util.*;
  public class Tester2
  {
    public static void main(String[] args)
    {
      int[] array = new int[] {1,2,3,1,2,3};
  
      System.out.println(Arrays.toString(deleteElement(array, 1)));
  
    }
  
    public static int[] deleteElement(int [] array, int target)
    {
      ArrayList&lt;Integer&gt; a1 = new ArrayList&lt;Integer&gt;();
  
      for(int i=0; i&lt;array.length; i++)
      {
        if (array[i] != target)
      a1.add(array[i]);
      }
  
      int[] returnedArray = new int[a1.size()];
      returnedArray = a1.toArray(returnedArray);
  
      return returnedArray;
  
    }  
  }
  </code></pre>
  
  <p>When I try to compile this code I get the following error:</p>
  
  <p>1 error found:</p>
  
  <p>File: /Users/Hyeunjoon/Desktop/CS/A4/Tester2.java  [line: 25]</p>
  
  <p>Error: /Users/Hyeunjoon/Desktop/CS/A4/Tester2.java:25: cannot find symbol</p>
  
  <p>symbol  : method toArray(int[])</p>
  
  <p>location: class java.util.ArrayList</p>
  
  <p>Can anyone help me out? I don't understand why I am getting this error</p>