Here you can find the source of toPrimitiveArray(Boolean[] a)
public static boolean[] toPrimitiveArray(Boolean[] a)
//package com.java2s; /* =========================================================================== * Copyright (C) 2015 CapsicoHealth Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License./*ww w . j ava 2 s. c o m*/ */ public class Main { protected static final boolean[] EMPTY_BOOLEAN_P = {}; protected static final int[] EMPTY_INTEGER_P = {}; protected static final long[] EMPTY_LONG_P = {}; protected static final float[] EMPTY_FLOAT_P = {}; protected static final double[] EMPTY_DOUBLE_P = {}; protected static final char[] EMPTY_CHARACTER_P = {}; public static boolean[] toPrimitiveArray(Boolean[] a) { if (a == null) return EMPTY_BOOLEAN_P; boolean[] A = new boolean[a.length]; for (int i = 0; i < a.length; ++i) A[i] = a[i]; return A; } public static int[] toPrimitiveArray(Integer[] a) { if (a == null) return EMPTY_INTEGER_P; int[] A = new int[a.length]; for (int i = 0; i < a.length; ++i) A[i] = a[i]; return A; } public static long[] toPrimitiveArray(Long[] a) { if (a == null) return EMPTY_LONG_P; long[] A = new long[a.length]; for (int i = 0; i < a.length; ++i) A[i] = a[i]; return A; } public static float[] toPrimitiveArray(Float[] a) { if (a == null) return EMPTY_FLOAT_P; float[] A = new float[a.length]; for (int i = 0; i < a.length; ++i) A[i] = a[i]; return A; } public static double[] toPrimitiveArray(Double[] a) { if (a == null) return EMPTY_DOUBLE_P; double[] A = new double[a.length]; for (int i = 0; i < a.length; ++i) A[i] = a[i]; return A; } public static char[] toPrimitiveArray(Character[] a) { if (a == null) return EMPTY_CHARACTER_P; char[] A = new char[a.length]; for (int i = 0; i < a.length; ++i) A[i] = a[i]; return A; } }