Here you can find the source of setBitAt(int offset, boolean bitValue, byte aByte)
public static byte setBitAt(int offset, boolean bitValue, byte aByte)
//package com.java2s; //License from project: Apache License public class Main { public static byte setBitAt(int offset, boolean bitValue, byte aByte) { return (byte) ((bitValue) ? (aByte | (1 << offset)) : (aByte & ~(1 << offset))); }/*from w ww .ja va2s .c o m*/ }