Here you can find the source of setBit(int flag, int i)
public static final int setBit(int flag, int i)
//package com.java2s; /*//ww w . j a v a 2 s . co m * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ public class Main { /** * @return `flag' with bit `i' set to 1 */ public static final int setBit(int flag, int i) { return flag | pow2(i); } private static final int pow2(int n) { return 1 << n; } }