Java Bit Set setBit(short shortIn, int bitPos)

Here you can find the source of setBit(short shortIn, int bitPos)

Description

set Bit

License

Open Source License

Declaration

public static short setBit(short shortIn, int bitPos) 

Method Source Code

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

public class Main {
    public static short setBit(short shortIn, int bitPos) {
        short mask = (short) (1 << bitPos);
        return (short) (shortIn | mask);
    }/*from   w ww.  j  a  v a  2 s  .c om*/
}

Related

  1. setBit(int value, int bitmask, boolean set)
  2. setBit(int value, int flags)
  3. setBit(int value, int index)
  4. setBit(int[] x, int i, int v)
  5. setBit(long[] data, int position, int bitWidth)
  6. setBitAt(byte flags, int pos, boolean value)
  7. setBitAt(int bitIndex, boolean value, byte b)
  8. setBitAt(int offset, boolean bitValue, byte aByte)
  9. setBitAt(int offset, boolean bitValue, byte aByte)