code: public static int[] unbox (Collection<Integer> list)
      {
          if (list == null) {
              return null;
          }
          int[] unboxed = new int[list.size()];
          int ii = 0;
          for (Integer value : list) {
              unboxed[ii++] = value;
          }
          return unboxed;
      }
docs: Converts an array of Integer objects to an array of primitives.