Java Bit Set setBit(byte b, int pos)

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

Description

set Bit

License

Open Source License

Parameter

Parameter Description
b a parameter
pos a parameter

Declaration

public static byte setBit(byte b, int pos) 

Method Source Code

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

public class Main {
    /**/*from w ww  .  ja v  a 2  s. c o m*/
     *
     * @param b
     * @param pos
     * @return
     */
    public static byte setBit(byte b, int pos) {
        return (byte) (b | (1 << pos));
    }
}

Related

  1. SetBit(byte _bitset, byte bit)
  2. setBit(byte _byte, int position, boolean value)
  3. setBit(byte a, int pos, boolean set)
  4. setBit(byte b, int i)
  5. setBit(byte data, byte bit, boolean value)
  6. setBit(byte data, int bitNumber, boolean value)
  7. setBit(byte data, int bitPos, boolean on)
  8. setBit(byte data, int pos, int val)