Converts an array of Integer objects into an equivalent
array of int primitives.
@param ints the array of Integer objects
@return the primitive ints array
4049
protected int[] convert( final Integer[] ints) {
		int[] array = new int[ ints.length];
		int count = 0;
		for ( int i : ints) array[ count++] = i;
		return array;
	}
434471
private static int[] toIntArray(List<Integer> list) {
		int[] array = new int[list.size()];
		int i = 0;
		for (Integer intObj : list) {
			array[i++] = toInt(intObj);
		}
		return array;
	}
191999
public static int[] parseInts(String nums, String sperator) {
        String[] ss = StringUtils.split(nums, sperator);
        int[] ints = new int[ss.length];
        for (int i = 0; i < ss.length; i++) {
            ints[i] = Integer.parseInt(ss[i]);
        }
        return ints;
    }
232901
protected static Object primitiveArrayGet(Object self, int idx) {
        return Array.get(self, normaliseIndex(idx, Array.getLength(self)));
    }
387945
static Integer[] createIntegers() {
        int len = INTEGER_UPPER_BOUND - INTEGER_LOWER_BOUND + 1;
        Integer[] ret = new Integer[len];
        int val = (int) INTEGER_LOWER_BOUND;
        for (int i = 0; i < len; i++, val++) {
            ret[i] = new Integer(val);
        }
        return ret;
    }
649727
public static List<Integer> asList(int[] array) {
    List<Integer> l = new ArrayList<Integer>();
    for (int i : array) {
      l.add(i);
    }
    return l;
  }
20806
private static List<Object> arrayToList(final Object array) {
    if (array instanceof Object[])
      return Arrays.asList((Object[]) array);

    List<Object> result = new ArrayList<Object>();
    // Arrays of the primitive types can't be cast to array of Object, so this:
    if (array instanceof int[])
      for (int value : (int[]) array) result.add(value);
    else if (array instanceof boolean[])
      for (boolean value : (boolean[]) array) result.add(value);
    else if (array instanceof long[])
      for (long value : (long[]) array) result.add(value);
    else if (array instanceof float[])
      for (float value : (float[]) array) result.add(value);
    else if (array instanceof double[])
      for (double value : (double[]) array) result.add(value);
    else if (array instanceof short[])
      for (short value : (short[]) array) result.add(value);
    else if (array instanceof byte[])
      for (byte value : (byte[]) array) result.add(value);
    else if (array instanceof char[])
      for (char value : (char[]) array) result.add(value);
    return result;
  }
208111
public static List primitiveArrayToList(Object array) {
        int size = Array.getLength(array);
        List list = new ArrayList(size);
        for (int i = 0; i < size; i++) {
            Object item = Array.get(array, i);
            if (item != null && item.getClass().isArray() && item.getClass().getComponentType().isPrimitive()) {
                item = primitiveArrayToList(item);
            }
            list.add(item);
        }
        return list;
    }
435693
public static int[] toArray(final Collection<Integer> collection) {
        Objects.requireNonNull(collection);
        
        final int size = collection.size();
        final int[] array = new int[size];
        
        int i=0;
        for(Integer value : collection) {
            array[i] = value;
            i++;
        }
        
        return array;
    }
443606
public static Object toPrimitiveIntArray(List<?> values)
    {
        int[] array = new int[values.size()];
        int cursor = 0;
        
        for(Object o : values)
        {
            array[cursor] = (Integer) o;
            cursor ++;
        }
        return array;
    }
1140597
public static Stream<Integer> box(final int[] integers) {
        return new FixedSizeStream<>(integers.length, new Func1<Integer, Integer>() {
            @Override
            public Integer call(Integer index) {
                return integers[index];
            }
        });
    }
911003
public static int[] parseInts(String[] intStrings) {
    int[] values = new int[intStrings.length];
    for (int i = 0; i < intStrings.length; i++) {
      values[i] = Integer.parseInt(intStrings[i].trim());
    }
    return values;
  }
451792
@SuppressWarnings("unchecked")
    public static List<Float> getAt(float[] array, Collection indices) {
        return primitiveArrayGet(array, indices);
    }
196084
static int[] uniquify(int[] ints, int start, int end) {
        IntSet iset = new IntSet();
        for (int i = end; --i >= start; ) {
            iset.add(ints[i]);
        }
        return iset.toIntArray();
    }
763726
public static <T> Level0ArrayOperator<Integer[],Integer> onArrayFor(final Integer... elements) {
        return onArrayOf(Types.INTEGER, VarArgsUtil.asRequiredObjectArray(elements));
    }
890135
private static Integer[] castToInteger( int[] d )
    {
        Integer[] dest = new Integer[d.length];
        for ( int i = 0; i < d.length; i++ )
        {
            dest[i] = d[i];
        }
        return dest;
    }
1139420
public static /*@pure@*/ int maxIndex(int[] ints) {

    int maximum = 0;
    int maxIndex = 0;

    for (int i = 0; i < ints.length; i++) {
      if ((i == 0) || (ints[i] > maximum)) {
	maxIndex = i;
	maximum = ints[i];
      }
    }

    return maxIndex;
  }