Here you can find the source of toObject(boolean[] array)
public static Boolean[] toObject(boolean[] array)
//package com.java2s; public class Main { public static final Boolean[] EMPTY_BOOLEAN_OBJECT_ARRAY = new Boolean[0]; public static final Character[] EMPTY_CHARACTER_OBJECT_ARRAY = new Character[0]; public static final Byte[] EMPTY_BYTE_OBJECT_ARRAY = new Byte[0]; public static final Short[] EMPTY_SHORT_OBJECT_ARRAY = new Short[0]; public static final Integer[] EMPTY_INTEGER_OBJECT_ARRAY = new Integer[0]; public static final Long[] EMPTY_LONG_OBJECT_ARRAY = new Long[0]; public static final Float[] EMPTY_FLOAT_OBJECT_ARRAY = new Float[0]; public static final Double[] EMPTY_DOUBLE_OBJECT_ARRAY = new Double[0]; public static Boolean[] toObject(boolean[] array) { if (array == null) return null; if (array.length == 0) { return EMPTY_BOOLEAN_OBJECT_ARRAY; }// w ww . j a va 2 s . co m Boolean[] result = new Boolean[array.length]; for (int i = 0; i < array.length; i++) { result[i] = Boolean.valueOf(array[i]); } return result; } public static Byte[] toObject(byte[] array) { if (array == null) return null; if (array.length == 0) { return EMPTY_BYTE_OBJECT_ARRAY; } Byte[] result = new Byte[array.length]; for (int i = 0; i < array.length; i++) { result[i] = Byte.valueOf(array[i]); } return result; } public static Character[] toObject(char[] array) { if (array == null) return null; if (array.length == 0) { return EMPTY_CHARACTER_OBJECT_ARRAY; } Character[] result = new Character[array.length]; for (int i = 0; i < array.length; i++) { result[i] = Character.valueOf(array[i]); } return result; } public static Double[] toObject(double[] array) { if (array == null) return null; if (array.length == 0) { return EMPTY_DOUBLE_OBJECT_ARRAY; } Double[] result = new Double[array.length]; for (int i = 0; i < array.length; i++) { result[i] = Double.valueOf(array[i]); } return result; } public static Float[] toObject(float[] array) { if (array == null) return null; if (array.length == 0) { return EMPTY_FLOAT_OBJECT_ARRAY; } Float[] result = new Float[array.length]; for (int i = 0; i < array.length; i++) { result[i] = Float.valueOf(array[i]); } return result; } public static Integer[] toObject(int[] array) { if (array == null) return null; if (array.length == 0) { return EMPTY_INTEGER_OBJECT_ARRAY; } Integer[] result = new Integer[array.length]; for (int i = 0; i < array.length; i++) { result[i] = Integer.valueOf(array[i]); } return result; } public static Long[] toObject(long[] array) { if (array == null) return null; if (array.length == 0) { return EMPTY_LONG_OBJECT_ARRAY; } Long[] result = new Long[array.length]; for (int i = 0; i < array.length; i++) { result[i] = Long.valueOf(array[i]); } return result; } public static Short[] toObject(short[] array) { if (array == null) return null; if (array.length == 0) { return EMPTY_SHORT_OBJECT_ARRAY; } Short[] result = new Short[array.length]; for (int i = 0; i < array.length; i++) { result[i] = Short.valueOf(array[i]); } return result; } }