Java Bit Unset unsetBit(byte original, int bitToUnSet)

Here you can find the source of unsetBit(byte original, int bitToUnSet)

Description

Sets a bit to zero in a byte then returns new byte

License

Open Source License

Parameter

Parameter Description
original byte
bitToUnSet bit to set

Return

byte with changed bit

Declaration

public static byte unsetBit(byte original, int bitToUnSet) 

Method Source Code

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

public class Main {
    /**/*ww w  . java2s.  c o m*/
     * Sets a bit to zero in a byte then returns new byte
     * @param original   byte
     * @param bitToUnSet bit to set
     *
     * @return byte with changed bit
     */
    public static byte unsetBit(byte original, int bitToUnSet) {
        return (byte) (original & ~(1 << bitToUnSet));
    }
}

Related

  1. unset(byte[] bytes)
  2. unsetb(int num, int bitmask)
  3. UnsetBit(byte _bitset, byte bit)
  4. unsetBit(byte b, int pos)
  5. unsetBit(byte[] b, int index)
  6. unsetBit(int f, int i)
  7. unSetBit(int integer, int bit)
  8. unsetBit(int value, int flags)