convert list of integer to array in java

Java
List<Integer> al = new ArrayList<Integer>(); 
Integer[] arr = new Integer[al.size()]; 
arr = al.toArray(arr); 
Source

Also in Java: