title: Converting a wrapper class array to primitive array using ArrayUtils
body: <p>I have created an ArrayList of Integer wrapper class, then converted it into Integer type array. Now my goal is to convert it into int type array. Try to solve the problem using <strong>ArrayUtils.toPrimitive()</strong> method. But it's having some issues.
  Here is my code: </p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.Arrays;
  import java.lang.Object;
  
  public class ArrayListToArray {
      public static void main(String[] args) {
  
          // Convert to int array in one line
  
          ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;();
  
          list.add(Integer.parseInt("1"));
          list.add(Integer.parseInt("2"));
          list.add(Integer.parseInt("3"));
          list.add(Integer.parseInt("4"));
  
          Integer[] wrapperArr = list.toArray(new Integer[list.size()]);
  
          // If you want a `primitive` type array
          int[] arr = ArrayUtils.toPrimitive(wrapperArr);
  
          System.out.println(Arrays.toString(arr));
      }
  }
  </code></pre>
  
  <p>It's showing error <strong>ArrayUtils can't be resolved.</strong> And now executing the code. </p>
  
  <p>How to solve the problem without writing any loop ? 
  I am exploring java built-in classes, methods and packages. </p>
  
  <p>Or is there <strong>any other methods other than ArrayUtils</strong>, to do the same ?</p>
  
  <p>Thanks in advance. :-)</p>