Android Byte Bit Set setBit(byte b, int bit)

Here you can find the source of setBit(byte b, int bit)

Description

set Bit

License

Open Source License

Declaration

public static byte setBit(byte b, int bit) 

Method Source Code

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

public class Main {
    public static byte setBit(byte b, int bit) {
        if (bit < 0 || bit >= 8)
            return b;
        return (byte) (b | (1 << bit));
    }//  w  w  w . j  ava  2s  . c om
}

Related

  1. isBitSet(byte b, int bit)