Here you can find the source of setBit(int mask, int bit, boolean value)
public static int setBit(int mask, int bit, boolean value)
//package com.java2s; //License from project: LGPL public class Main { public static int setBit(int mask, int bit, boolean value) { mask |= (value ? 1 : 0) << bit; return mask; }// w ww . j a va 2 s . com }