Java Bit Set setBit(int position, boolean value, int meta)

Here you can find the source of setBit(int position, boolean value, int meta)

Description

set Bit

License

Open Source License

Declaration

public static int setBit(int position, boolean value, int meta) 

Method Source Code

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

public class Main {
    public static int setBit(int position, boolean value, int meta) {
        if (value) {
            return meta | (1 << position);
        }/*from   ww w  .  j a  v  a 2 s  .  c om*/
        return meta & ~(1 << position);
    }
}

Related

  1. setBit(int i, int bit, boolean enabled)
  2. setBit(int i, int bit, boolean state)
  3. setBit(int integer, int bit)
  4. setBit(int mask, int bit, boolean value)
  5. setBit(int n, int bitPosition)
  6. setBit(int position, byte[] array)
  7. setBit(int value, int bit)
  8. setBit(int value, int bitIndex)
  9. setBit(int value, int bitmask, boolean set)