Android Int Bit Set isBitSet(int b, int bit)

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

Description

is Bit Set

License

Open Source License

Declaration

public static boolean isBitSet(int b, int bit) 

Method Source Code

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

public class Main {
    public static boolean isBitSet(byte b, int bit) {
        if (bit < 0 || bit >= 8)
            return false;
        return (b & (1 << bit)) > 0;
    }/* ww  w . j  a v  a 2  s. c  om*/

    public static boolean isBitSet(int b, int bit) {
        if (bit < 0 || bit >= 32)
            return false;
        return (b & (1 << bit)) > 0;
    }
}

Related

  1. setBit(int number, int count)
  2. setBit(int number, int count, boolean value)
  3. isBitSet(int number, int count)
  4. isPowerOfTwo(int v)
  5. clearBit(int number, int count)
  6. contains(int bit, int... options)