Java Primitive Type Create toPrimitive(Boolean[] array)

Here you can find the source of toPrimitive(Boolean[] array)

Description

to Primitive

License

Open Source License

Declaration

public static boolean[] toPrimitive(Boolean[] array) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static boolean[] toPrimitive(Boolean[] array) {

        boolean[] primitiveArray = new boolean[array.length];

        for (int i = 0; i < array.length; i++) {
            primitiveArray[i] = array[i];
        }//  w  ww .j av  a 2s  .  c  om

        return primitiveArray;
    }

    public static byte[] toPrimitive(Byte[] array) {

        byte[] primitiveArray = new byte[array.length];

        for (int i = 0; i < array.length; i++) {
            primitiveArray[i] = array[i];
        }

        return primitiveArray;
    }

    public static short[] toPrimitive(Short[] array) {

        short[] primitiveArray = new short[array.length];

        for (int i = 0; i < array.length; i++) {
            primitiveArray[i] = array[i];
        }

        return primitiveArray;
    }

    public static int[] toPrimitive(Integer[] array) {

        int[] primitiveArray = new int[array.length];

        for (int i = 0; i < array.length; i++) {
            primitiveArray[i] = array[i];
        }

        return primitiveArray;
    }

    public static long[] toPrimitive(Long[] array) {

        long[] primitiveArray = new long[array.length];

        for (int i = 0; i < array.length; i++) {
            primitiveArray[i] = array[i];
        }

        return primitiveArray;
    }

    public static float[] toPrimitive(Float[] array) {

        float[] primitiveArray = new float[array.length];

        for (int i = 0; i < array.length; i++) {
            primitiveArray[i] = array[i];
        }

        return primitiveArray;
    }

    public static double[] toPrimitive(Double[] array) {

        double[] primitiveArray = new double[array.length];

        for (int i = 0; i < array.length; i++) {
            primitiveArray[i] = array[i];
        }

        return primitiveArray;
    }
}

Related

  1. toPrimitive(Boolean b)
  2. toPrimitive(Byte[] byteArray)
  3. toPrimitive(Byte[] bytes)
  4. toPrimitive(Byte[] objectArray)
  5. toPrimitive(Character value)