Check if kth bit is set
Java
Medium
5 views
Problem Description
Task: return true if k-th bit is set.
Output Format
Return value
Constraints
k between 0..30.
Official Solution
static boolean isBitSet(int x,int k){return (x & (1<<k))!=0;}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!