Java Bit Clean clearBits(int value, int bits)

Here you can find the source of clearBits(int value, int bits)

Description

Clear selected bit(s) in giving value

License

Open Source License

Parameter

Parameter Description
value value
bit bit or bit set to clear in the value

Return

value with cleared selected bits

Declaration

public static int clearBits(int value, int bits) 

Method Source Code

//package com.java2s;
/**//  ww  w . j  a v a 2 s  . co m
 * @licence GNU Leser General Public License
 *
 * $Id$
 * $HeadURL$
 */

public class Main {
    /**
     * Clear selected bit(s) in giving value
     * 
     * @param value value
     * @param bit bit or bit set to clear in the value
     * @return <code>value</code> with cleared selected bits
     */
    public static int clearBits(int value, int bits) {
        return value & ~bits;
    }
}

Related

  1. clearBit(int value, int bit)
  2. clearBit(int value, int bitIndex)
  3. clearBit(int value, int index)
  4. clearBit(long n, int i)
  5. clearBit33ofDTS(byte[] array, int offset)
  6. clearBits(long value, long bits)
  7. clearBitsAfterInLastWord(int lastWord, int lastSetBit)
  8. clearBitsUpToLS(int n, int i)