Here you can find the source of setBit(byte original, int bitToSet)
Parameter | Description |
---|---|
original | byte |
bitToSet | bit to set |
public static byte setBit(byte original, int bitToSet)
//package com.java2s; //License from project: Open Source License public class Main { /**/* ww w . j a v a 2 s .co m*/ * Sets a bit to one in a byte then returns new byte * @param original byte * @param bitToSet bit to set * * @return byte with changed bit */ public static byte setBit(byte original, int bitToSet) { return (byte) (original | (1 << bitToSet)); } }