Java Array Unpack unpackDie(byte[] bytes)

Here you can find the source of unpackDie(byte[] bytes)

Description

unpack Die

License

Open Source License

Declaration

public static boolean[] unpackDie(byte[] bytes) 

Method Source Code

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

public class Main {
    public static boolean[] unpackDie(byte[] bytes) {
        boolean[] bits = new boolean[bytes.length * 8];

        int mask = 1;

        for (int i = 0; i < bits.length; i++) {
            int dataIndex = i / 8;
            byte dataByte = bytes[dataIndex];
            int bitIndex = i % 8;

            bits[i] = (dataByte & ((byte) (mask << bitIndex))) != 0;
        }/*from w  w  w . jav  a  2  s . c  o m*/

        return bits;
    }
}

Related

  1. unpack(byte[] array)
  2. unpack(byte[] bytes)
  3. unpack(double[] packed, int width, int height, int outputIndex)
  4. unpack(int[] sourcearray, int arraypos, int[] data, int datapos, int num, int b)
  5. unpackBCD(byte[] source)
  6. UnpackFloat(byte[] bytes, float value)
  7. UnpackFloatBuffer(byte[] buffer, long bytes_read, long num_loaded, float[] list)
  8. unpackInt(byte[] data, int offset)
  9. unpackIntegerByWidth(int len, byte[] buf, int offset)