Here you can find the source of toBooleanArray(byte a, boolean[] buf)
Parameter | Description |
---|---|
a | - The byte to convert. |
buf | - The boolean array to store the data in. Must be a length of at least 8. |
public static void toBooleanArray(byte a, boolean[] buf)
//package com.java2s; //License from project: Apache License public class Main { /**/*from w w w. j a v a 2 s . c o m*/ * Turns the requested byte into a binary based boolean array with a length of 8. Each digit of the binary code indicated * each boolean in the array. For example, a binary value of 10011001 would return the values of "true, false, false, true, * true, false, false, true." * @param a - The byte to convert. * @param buf - The boolean array to store the data in. Must be a length of at least 8. */ public static void toBooleanArray(byte a, boolean[] buf) { buf[0] = (a & 128) == 128; buf[1] = (a & 64) == 64; buf[2] = (a & 32) == 32; buf[3] = (a & 16) == 16; buf[4] = (a & 8) == 8; buf[5] = (a & 4) == 4; buf[6] = (a & 2) == 2; buf[7] = (a & 1) == 1; } }