Here you can find the source of toPrimitiveArray(Byte[] array)
public static byte[] toPrimitiveArray(Byte[] array)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] toPrimitiveArray(Byte[] array) { if (array == null) { return null; } else {//w w w . jav a2 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[] toPrimitiveArray(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 int[] toPrimitiveArray(Integer[] array) { if (array == null) { return null; } else { int[] result = new int[array.length]; for (int i = 0; i < array.length; i++) { result[i] = array[i]; } return result; } } public static long[] toPrimitiveArray(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[] toPrimitiveArray(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[] toPrimitiveArray(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 char[] toPrimitiveArray(Character[] array) { if (array == null) { return null; } else { char[] result = new char[array.length]; for (int i = 0; i < array.length; i++) { result[i] = array[i]; } return result; } } public static boolean[] toPrimitiveArray(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; } } }