Here you can find the source of unsetb(int num, int bitmask)
public static int unsetb(int num, int bitmask)
//package com.java2s; //License from project: Apache License public class Main { public static int unsetb(int num, int bitmask) { if (bset(num, bitmask)) num -= bitmask;// w w w . j a v a2 s .c o m return num; } public static long unsetb(long num, long bitmask) { if (bset(num, bitmask)) num -= bitmask; return num; } public static long unsetb(long num, int bitmask) { if (bset(num, bitmask)) num -= bitmask; return num; } public static boolean bset(int num, int bitmask) { return ((num & bitmask) == bitmask); } public static boolean bset(long num, long bitmask) { return ((num & bitmask) == bitmask); } public static boolean bset(long num, int bitmask) { return ((num & bitmask) == bitmask); } }