Java Bit Unset unsetFlag(final int data, final int flag)

Here you can find the source of unsetFlag(final int data, final int flag)

Description

Unsets a flag.

License

Open Source License

Parameter

Parameter Description
data Data to remove flag from.
flag Flag to remove.

Return

Data with flag unset.

Declaration

public static int unsetFlag(final int data, final int flag) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from w  w w  .  j a  v a2 s  .com*/
     * Unsets a flag.
     * E.G.
     * - Flag: 000101
     * - Mask: 100101
     * - The 4th and 6th bit will be unset, the 1st bit is maintained.
     *
     * @param data Data to remove flag from.
     * @param flag Flag to remove.
     * @return Data with flag unset.
     */
    public static int unsetFlag(final int data, final int flag) {
        return data & ~flag;
    }
}

Related

  1. unsetBit(byte[] b, int index)
  2. unsetBit(int f, int i)
  3. unSetBit(int integer, int bit)
  4. unsetBit(int value, int flags)
  5. unsetBit(long flags, long bit)
  6. unsetFlag(int bitset, int flag)
  7. unsetHighBit(int integer)