Android Byte Array to Boolean Array Convert getBooleans(byte[] bytes, int length)

Here you can find the source of getBooleans(byte[] bytes, int length)

Description

get Booleans

Declaration

public static boolean[] getBooleans(byte[] bytes, int length) 

Method Source Code

//package com.java2s;

public class Main {
    public static boolean[] getBooleans(byte[] bytes, int length) {
        boolean[] booleans = new boolean[length];

        for (int i = 0; i < length; i++) {
            final int word = i >>> 3;
            booleans[i] = (bytes[word] & (1 << (i & 7))) != 0;
        }/*from   ww w  .  ja v  a2s .  co  m*/
        return booleans;
    }
}