Java Object Array Create toObjectArray(byte[] array)

Here you can find the source of toObjectArray(byte[] array)

Description

to Object Array

License

Apache License

Declaration

public static Byte[] toObjectArray(byte[] array) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static Byte[] toObjectArray(byte[] array) {
        if (array == null) {
            return null;
        } else {//from ww w. j  a  va2  s  .  c  o m
            Byte[] result = new Byte[array.length];
            for (int i = 0; i < array.length; i++) {
                result[i] = array[i];
            }
            return result;
        }
    }

    public static Short[] toObjectArray(short[] array) {
        if (array == null) {
            return null;
        } else {
            Short[] result = new Short[array.length];
            for (int i = 0; i < array.length; i++) {
                result[i] = array[i];
            }
            return result;
        }
    }

    public static Integer[] toObjectArray(int[] array) {
        if (array == null) {
            return null;
        } else {
            Integer[] result = new Integer[array.length];
            for (int i = 0; i < array.length; i++) {
                result[i] = array[i];
            }
            return result;
        }
    }

    public static Long[] toObjectArray(long[] array) {
        if (array == null) {
            return null;
        } else {
            Long[] result = new Long[array.length];
            for (int i = 0; i < array.length; i++) {
                result[i] = array[i];
            }
            return result;
        }
    }

    public static Float[] toObjectArray(float[] array) {
        if (array == null) {
            return null;
        } else {
            Float[] result = new Float[array.length];
            for (int i = 0; i < array.length; i++) {
                result[i] = array[i];
            }
            return result;
        }
    }

    public static Double[] toObjectArray(double[] array) {
        if (array == null) {
            return null;
        } else {
            Double[] result = new Double[array.length];
            for (int i = 0; i < array.length; i++) {
                result[i] = array[i];
            }
            return result;
        }
    }

    public static Character[] toObjectArray(char[] array) {
        if (array == null) {
            return null;
        } else {
            Character[] result = new Character[array.length];
            for (int i = 0; i < array.length; i++) {
                result[i] = array[i];
            }
            return result;
        }
    }

    public static Boolean[] toObjectArray(boolean[] array) {
        if (array == null) {
            return null;
        } else {
            Boolean[] result = new Boolean[array.length];
            for (int i = 0; i < array.length; i++) {
                result[i] = array[i];
            }
            return result;
        }
    }
}

Related

  1. toObjectArray(boolean arr[])
  2. toObjectArray(boolean[] primitiveArray)
  3. toObjectArray(char... array)
  4. toObjectArray(int[] array)
  5. toObjectArray(int[] array)
  6. toObjectArray(int[] oldArray)