Java Bit Set setBit(byte input, int bit)

Here you can find the source of setBit(byte input, int bit)

Description

set Bit

License

Apache License

Declaration

public static byte setBit(byte input, int bit) 

Method Source Code

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

public class Main {
    private static final byte[] BYTE = new byte[] { -128, 64, 32, 16, 8, 4, 2, 1 };

    public static byte setBit(byte input, int bit) {
        return (byte) (input | BYTE[bit]);
    }/* w w w  .  j av  a2  s.  c  om*/
}

Related

  1. setBit(byte data, byte bit, boolean value)
  2. setBit(byte data, int bitNumber, boolean value)
  3. setBit(byte data, int bitPos, boolean on)
  4. setBit(byte data, int pos, int val)
  5. setBit(byte in, int position, boolean value)
  6. setBit(byte original, int bitToSet)
  7. setBit(byte target, byte pos)
  8. setBit(byte v, int position, boolean value)
  9. setBit(byte value, int bit, boolean on)