Java Utililty Methods Object Array Create

List of utility methods to do Object Array Create

Description

The list of methods to do Object Array Create are organized into topic(s).

Method

Boolean[]toObjectArray(boolean arr[])
to Object Array
if (arr == null)
    return null;
Boolean result[] = new Boolean[arr.length];
for (int i = arr.length - 1; i >= 0; i--)
    result[i] = arr[i];
return result;
Boolean[]toObjectArray(boolean[] primitiveArray)
to Object Array
final Boolean[] objects = new Boolean[primitiveArray.length];
int index = 0;
for (boolean b : primitiveArray)
    objects[index++] = Boolean.valueOf(b);
return objects;
Byte[]toObjectArray(byte[] array)
to Object Array
if (array == null) {
    return null;
} else {
    Byte[] result = new Byte[array.length];
    for (int i = 0; i < array.length; i++) {
        result[i] = array[i];
    return result;
...
Character[]toObjectArray(char... array)
to Object 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] = array[i];
return result;
...
Integer[]toObjectArray(int[] array)
to Object Array
if (array == null) {
    return null;
Integer[] data = new Integer[array.length];
for (int i = 0; i < array.length; i++) {
    data[i] = new Integer(array[i]);
return data;
...
Integer[]toObjectArray(int[] array)
to Object Array
Integer[] result = new Integer[array.length];
for (int i = 0; i < array.length; i++)
    result[i] = array[i];
return result;
Integer[]toObjectArray(int[] oldArray)
to Object Array
Integer[] newArray = new Integer[oldArray.length];
for (int ctr = 0; ctr < oldArray.length; ctr++) {
    newArray[ctr] = Integer.valueOf(oldArray[ctr]);
return newArray;
Object[]toObjectArray(Object array)
Convert an array of primitive types to an array of objects.
if (array instanceof Object[]) {
    return (Object[]) array;
if (array instanceof int[]) {
    int i;
    int k = ((int[]) array).length;
    Integer[] r = new Integer[k];
    for (i = 0; i < k; i++)
...
Object[][]toObjectArray(String[][] originalarray)
Copies an array to a new one
Object[][] data = new Object[originalarray.length][];
for (int idx = 0; idx < originalarray.length; idx++) {
    for (int i = 0; i < originalarray[idx].length; i++) {
        data[idx][i] = String.valueOf(originalarray[idx][i]);
return data;
Object[]toObjectArray(T... t)
Converts the given parameters to an object array.
Object[] decorator = new Object[t.length];
System.arraycopy(t, 0, decorator, 0, t.length);
return decorator;