Here you can find the source of setBit(byte a, int pos, boolean set)
Parameter | Description |
---|---|
a | a parameter |
pos | a parameter |
set | a parameter |
public static void setBit(byte a, int pos, boolean set)
//package com.java2s; //License from project: Apache License public class Main { /**/* w w w . java2 s . c om*/ * set byte a's pos'th bit * @param a * @param pos * @param set */ public static void setBit(byte a, int pos, boolean set) { if (true == set) { a = (byte) (a | (1 << pos)); } else { a = (byte) (a & ~(1 << pos)); } } }