Android Int Bit Set contains(int bit, int... options)

Here you can find the source of contains(int bit, int... options)

Description

contains

Declaration

public static boolean contains(int bit, int... options) 

Method Source Code

//package com.java2s;

public class Main {
    public static boolean contains(int bit, int... options) {
        return (bit & and(options)) == and(options);
    }//w w w .j av  a2  s . c om

    public static int and(int... options) {
        int out = options[0];

        for (int index = 1; index < options.length; index++) {
            out &= options[index];
        }

        return out;
    }
}

Related

  1. setBit(int number, int count, boolean value)
  2. isBitSet(int b, int bit)
  3. isBitSet(int number, int count)
  4. isPowerOfTwo(int v)
  5. clearBit(int number, int count)
  6. decode(int bits)
  7. nextHighestPowerOfTwo(int v)
  8. toggleBit(int number, int count)