Java Bit Set setBits(int value, int bits)

Here you can find the source of setBits(int value, int bits)

Description

Set selected bit(s) in giving value

License

Open Source License

Parameter

Parameter Description
value value
bit bit or bit set to set in the value

Return

value with set selected bits

Declaration

public static int setBits(int value, int bits) 

Method Source Code

//package com.java2s;
/**//from w  w  w. j a  v  a  2  s  .c om
 * @licence GNU Leser General Public License
 *
 * $Id$
 * $HeadURL$
 */

public class Main {
    /**
     * Set selected bit(s) in giving value
     * 
     * @param value value
     * @param bit bit or bit set to set in the value
     * @return <code>value</code> with set selected bits
     */
    public static int setBits(int value, int bits) {
        return value | bits;
    }
}

Related

  1. setBitmapRangeAndCardinalityChange(long[] bitmap, int start, int end)
  2. setBitRange(final int val, final int start, final int len, final int newVal)
  3. setBits(byte in, byte data, int position, int fillBits)
  4. setBits(final byte value, final int bitMask, final boolean val)
  5. setBits(int lowBit, int numBits)
  6. setBits(long value, long bits)
  7. setBitsFromLong(byte[] dst, long dstoff, long l, int off, int len)
  8. setBitsInLong(long l, int n, int k, long v)
  9. setBitTo0(final long word, final int idx)