Java Bit Set setBit(byte[] bytes, int off, boolean v)

Here you can find the source of setBit(byte[] bytes, int off, boolean v)

Description

set Bit

License

Open Source License

Declaration

public static void setBit(byte[] bytes, int off, boolean v) 

Method Source Code

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

public class Main {
    public static void setBit(byte[] bytes, int off, boolean v) {
        if (v)/*from  ww  w  .j a  va  2 s  . c om*/
            bytes[off / 8] |= (0x01 << (off % 8));
        else
            bytes[off / 8] &= ~(0x01 << (off % 8));
    }
}

Related

  1. setBit(byte[] arr, int bit)
  2. setBit(byte[] b, int index)
  3. setBit(byte[] ba, int bit_offset, boolean on)
  4. setBit(byte[] byteArray, int index)
  5. setBit(byte[] bytes, int bitNr, int bit)
  6. setBit(byte[] data, int index, boolean value)
  7. setBit(byte[] data, int pos, boolean val)
  8. setBit(byte[] data, int pos, int val)
  9. setBit(byte[] data, int pos, int val)