Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Set n bit in the integer value.
- * bit is 0 based.
- * @param value
- * @param bit
- * @return value with the n bit set
- */
- public static int setBit(int value, int bit) {
- int posVal = (int)Math.pow(2, (double)bit);
- return value | posVal;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement