Android Int Bit Set setBit(int number, int count, boolean value)

Here you can find the source of setBit(int number, int count, boolean value)

Description

set Bit

License

Open Source License

Declaration

public static int setBit(int number, int count, boolean value) 

Method Source Code

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

public class Main {
    public static int setBit(int number, int count) {
        return number | 0x01 << count;
    }/*  ww w.j av  a 2  s  . co  m*/

    public static int setBit(int number, int count, boolean value) {
        if (value) {
            return setBit(number, count);
        }
        return clearBit(number, count);
    }

    public static int clearBit(int number, int count) {
        return number | 0x01 << count;
    }
}

Related

  1. setBit(int number, int count)
  2. isBitSet(int b, int bit)
  3. isBitSet(int number, int count)
  4. isPowerOfTwo(int v)
  5. clearBit(int number, int count)