Here you can find the source of bitIsSet(int x, int pos)
Parameter | Description |
---|---|
x | The integer to be queried. |
pos | The bit to be queried. |
true
if the bit as position pos
is set.
static boolean bitIsSet(int x, int pos)
//package com.java2s; //License from project: Open Source License public class Main { /** //from w ww. j av a 2s .c o m * Determines whether a particular bit is set in the binary representation * of an integer. * @param x The integer to be queried. * @param pos The bit to be queried. * @return <code>true</code> if the bit as position <code>pos</code> is set. */ static boolean bitIsSet(int x, int pos) { return (x & (1 << pos)) != 0; } }