public static int[] toIntArray(@Nullable Collection<Integer> c){
  if (c == null || c.isEmpty())   return EMPTY_INTS;
  int[] arr=new int[c.size()];
  int idx=0;
  for (  Integer i : c)   arr[idx++]=i;
  return arr;
}

public static int [ ] toIntArray ( @ Nullable Collection < Integer > c ) { if ( c == null || c . isEmpty ( ) ) return EMPTY_INTS ; int [ ] arr = new int [ c . size ( ) ] ; int idx = 0 ; for ( Integer i : c ) arr [ idx ++ ] = i ; return arr ; }
converts collection of integers into array .
