Java Bit Clean clearBit(byte v, int position)

Here you can find the source of clearBit(byte v, int position)

Description

Returns v, with the bit at position set to zero.

License

Apache License

Declaration

public static byte clearBit(byte v, int position) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**//from ww  w  .ja va  2s  .c o  m
     * Returns v, with the bit at position set to zero.
     */
    public static byte clearBit(byte v, int position) {
        return (byte) clearBit((int) v, position);
    }

    public static short clearBit(short v, int position) {
        return (short) clearBit((int) v, position);
    }

    public static int clearBit(int v, int position) {
        return v & ~(1 << position);
    }

    public static long clearBit(long v, int position) {
        return v & ~(1L << position);
    }
}

Related

  1. clearBit(byte b, int i)
  2. clearBit(byte input, int bit)
  3. clearBit(int bits, int index)
  4. clearBit(int flag, int i)
  5. clearBit(int n, int bitPosition)
  6. clearBit(int value, int bit)