Java Boolean to Byte booleanToByte(boolean[] values)

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

Description

boolean To Byte

License

Open Source License

Declaration

public static byte[] booleanToByte(boolean[] values) 

Method Source Code

//package com.java2s;

public class Main {
    public static byte[] booleanToByte(boolean[] values) {
        if (values == null) {
            return null;
        }//w  w w . j  a va2 s . c  o m

        byte[] results = new byte[values.length];
        for (int i = 0; i < values.length; i++) {
            results[i] = (byte) (values[i] == true ? 1 : 0);
        }
        return results;
    }
}

Related

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