Java Bit Set setBitAt(int offset, boolean bitValue, byte aByte)

Here you can find the source of setBitAt(int offset, boolean bitValue, byte aByte)

Description

set Bit At

License

Apache License

Declaration

public static byte setBitAt(int offset, boolean bitValue, byte aByte) 

Method Source Code

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

public class Main {
    public static byte setBitAt(int offset, boolean bitValue, byte aByte) {
        return (byte) ((bitValue) ? (aByte | (1 << offset)) : (aByte & ~(1 << offset)));
    }/*from   w  ww .ja  va2s .c  o  m*/
}

Related

  1. setBit(long[] data, int position, int bitWidth)
  2. setBit(short shortIn, int bitPos)
  3. setBitAt(byte flags, int pos, boolean value)
  4. setBitAt(int bitIndex, boolean value, byte b)
  5. setBitAt(int offset, boolean bitValue, byte aByte)
  6. setBitBiInt(int b0, int b1, int value, int original)
  7. setBitByPos(byte byt, boolean bool, int pos)
  8. setBitInInt(int bits, int bitIndex, boolean flag)
  9. setBitInLong(long l, long n, int v)