convert a primitive array (value type) to Object Array (reference type).

@param primArr value type Array
@return reference type Array
493591
public static Float[] toReferenceType(float[] primArr) {
	Float[] refArr = new Float[primArr.length];
	for (int i = 0; i < primArr.length; i++)
	    refArr[i] = new Float(primArr[i]);
	return refArr;
    }
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;
  }
3996
public static <T> T[] toArray(Collection<T> col, Class<T> cls)
    {
        T[] arr = (T[]) Array.newInstance(cls, col.size());
        return col.toArray(arr);
    }
276598
public static Object[] toArray(Object obj)
	{
		if (obj instanceof Object[])
			return (Object[]) obj;
		else
		{
			Object[] returnArray =
			{ obj };
			return returnArray;

		}
	}
261275
public static Object concat(Object[] arrs)
    {
        int   totalLen            = 0;
        Class commonComponentType = null;
        for (int i = 0, len = arrs.length; i < len; i++)
        {
            // skip all null arrays
            if (arrs[i] == null)
            {
                continue;
            }

            int arrayLen = Array.getLength(arrs[i]);

            // skip all empty arrays
            if (arrayLen == 0)
            {
                continue;
            }

            totalLen += arrayLen;

            Class componentType = arrs[i].getClass().getComponentType();
            commonComponentType =
                (commonComponentType == null) ? componentType
                                              : commonClass(commonComponentType, componentType);
        }

        if (commonComponentType == null)
        {
            return null;
        }

        return concat(Array.newInstance(commonComponentType, totalLen), totalLen, arrs);
    }
27093
public static boolean isPrimitive(TypeReference ref) {
		if (ref.dimensions() > 0) return false;
		return PRIMITIVE_TYPE_NAME_PATTERN.matcher(toQualifiedName(ref.getTypeName())).matches();
	}
345186
@ReplacedBy("com.google.common.collect.Iterables#toArray()")
    public static <T> T[] toArray (Collection<? extends T> col, Class<T> type)
    {
        @SuppressWarnings("unchecked")
        T[] array = (T[]) Array.newInstance(type, col.size());
        return col.toArray(array);
    }
162308
protected static Vector convertToVector(final Object[] anArray) {
		if (anArray == null) {
			return null;
		}
		final Vector v = new Vector(anArray.length);
		for (final Object element : anArray) {
			v.addElement(element);
		}
		return v;
	}
61994
public static <T, J extends Convertable<T>> T[] convertToArray(J[] array) {
        return toArray(convert(array));
    }
142076
public static Object toPrimitiveDoubleArray(List<?> values)
    {
        double[] array = new double[values.size()];
        int cursor = 0;
        
        for(Object o : values)
        {
            array[cursor] = (Double) o;
            cursor ++;
        }
        return array;
    }
739900
public static boolean isArray(TypeRef type) {

        if (type instanceof ClassRef) {
            return ((ClassRef)type).getDimensions() > 0;
        } else if (type instanceof PrimitiveRef) {
            return ((PrimitiveRef)type).getDimensions() > 0;
        } else if (type instanceof TypeParamRef) {
            return ((TypeParamRef)type).getDimensions() > 0;
        } else {
            return false;
        }
    }
1250428
public byte[] byteArrayValue(final PrimitiveType type)
    {
        if (representation == Representation.BYTE_ARRAY)
        {
            return byteArrayValue;
        }
        else if (representation == Representation.LONG && size == 1 && type == PrimitiveType.CHAR)
        {
            byteArrayValueForLong[0] = (byte)longValue;
            return byteArrayValueForLong;
        }

        throw new IllegalStateException("PrimitiveValue is not a byte[] representation");
    }
1349553
public static Object[] convert( String[] values, Class[] toTypes )
    {
        Object[] converted = new Object[values.length];
        for (int i = 0; i < values.length; i++)
        {
            converted[i] = parse( values[i], toTypes[i] );
        }
        return converted;
    }
733491
public static Class convertPrimitiveToWrapper(Class clazz) {
		if (clazz == null || !clazz.isPrimitive())
			return clazz;

		return (Class) primativeToWrapperMap.get(clazz);
	}
384211
public final static Object toObjectArray(final Object array) {
        if (!array.getClass().isArray()) {
            return array;
        }
        final Class<?> clazz = PRIMITIVE_TO_OBJ.get(array.getClass().getComponentType());
        return setArray(clazz, array);
    }
1003849
public static byte[] toByteArray(ASN1Primitive obj)
	throws IOException {
	ByteArrayOutputStream bout = new ByteArrayOutputStream();
	DEROutputStream der = new DEROutputStream(bout);
	der.writeObject(obj);
	return bout.toByteArray();
    }
510377
public static Object convertToArray(final Class type, final List<?> values) {
        final Object exampleArray = Array.newInstance(type, values.size());
        try {
            return values.toArray((Object[]) exampleArray);
        } catch (ClassCastException e) {
            for (int i = 0; i < values.size(); i++) {
                Array.set(exampleArray, i, values.get(i));
            }
            return exampleArray;
        }
    }