private static int[] integerListToArray(List<Integer> list){
  int[] array=new int[list.size()];
  for (int i=0; i < list.size(); i++) {
    array[i]=list.get(i);
  }
  return array;
}

private static int [ ] integerListToArray ( List < Integer > list ) { int [ ] array = new int [ list . size ( ) ] ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { array [ i ] = list . get ( i ) ; } return array ; }
convert a list of integers to an int [ ]
