Here you can find the source of setBit(byte[] bytes, int off, boolean v)
public static void setBit(byte[] bytes, int off, boolean v)
//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)); } }