Java Boolean to Byte booleanToByte(boolean[] bool)

Here you can find the source of booleanToByte(boolean[] bool)

Description

Convert an array of booleans to bytes

License

Open Source License

Declaration

static byte[] booleanToByte(boolean[] bool) 

Method Source Code

//package com.java2s;

public class Main {
    /** Convert an array of booleans to bytes */
    static byte[] booleanToByte(boolean[] bool) {

        byte[] byt = new byte[bool.length];
        for (int i = 0; i < bool.length; i += 1) {
            byt[i] = bool[i] ? (byte) 'T' : (byte) 'F';
        }/*from   w w w  .  ja v  a  2  s.  co  m*/
        return byt;
    }
}

Related

  1. booleanToByte(boolean b)
  2. BooleanToByte(boolean value)
  3. booleanToByte(boolean x)
  4. booleanToByte(boolean[] array)
  5. booleanToByte(boolean[] values)
  6. booleanTobyte(final boolean value)
  7. booleanToByteBitflags(boolean[] flags)
  8. booleanToBytes(boolean b)