Java Boolean From toBooleanArray(int[] intArray, int n)

Here you can find the source of toBooleanArray(int[] intArray, int n)

Description

to Boolean Array

License

Eclipse Public License

Declaration

public static boolean[] toBooleanArray(int[] intArray, int n) 

Method Source Code

//package com.java2s;
/* ******************************************************************************
 * // w w  w  . j  a va2  s  .c  o m
 * This file is part of JMH
 * 
 * License:
 *   EPL: http://www.eclipse.org/legal/epl-v10.html
 *   LGPL 3.0: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
 *   See the LICENSE file in the project's top-level directory for details.
 *
 * **************************************************************************** */

public class Main {
    public static boolean[] toBooleanArray(int[] intArray, int n) {

        boolean[] array = new boolean[n];
        for (int element : intArray) {
            array[element] = true;
        }
        return array;
    }
}

Related

  1. toBooleanArray(byte[] array)
  2. toBooleanArray(byte[] byteArray)
  3. toBooleanArray(byte[] data)
  4. toBooleanArray(final E[] array)
  5. toBooleanArray(final Object[] array)
  6. toBooleanArray(Object[] vs)
  7. toBooleanDefaultIfNull(Boolean bool, boolean valueIfNull)
  8. toBooleanDefaultIfNull(Boolean bool, boolean valueIfNull)
  9. toBooleanObject(final int val)