/**来自
NowJava.com**/
//package com.book2s;
public class Main {
public static void main(String[] argv) {
Object objArray = "book2s.com";
System.out.println(java.util.Arrays.toString(toObject(objArray)));
}
/**
* Method to convert a Array Collection of int to a Array Collection of Integer.
* @param <T> the generic variable.
* @param objArray the Array Collection of int.
* @return Array Collection of Integer.
*/
@SuppressWarnings("unchecked")
public static <T> T[] toObject(Object objArray) {
//return org.apache.commons.lang3.ArrayUtils.toObject(intArray);
if (objArray == null)
return null;
else if (objArray[0].getClass() == int.class) {
if (objArray.length == 0)
return (T[]) new Integer[0];
final Integer[] result = new Integer[objArray.length];//时 代 J a v a
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。