Java Bit Set setBit(int flags, int bit)

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

Description

Set a bit or bit combination on bitmap

License

Open Source License

Parameter

Parameter Description
flags bitmap to change
bit bits to set

Return

updated bitmap with specified bits set

Declaration

public static int setBit(int flags, int bit) 

Method Source Code

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

public class Main {
    /**//from   w w w .  ja  v  a  2  s  .  c  om
     * Set a bit or bit combination on bitmap
     * @param flags  bitmap to change
     * @param bit bits to set
     * @return updated bitmap with specified bits set
     */
    public static int setBit(int flags, int bit) {
        return flags | bit;
    }

    /**
     * Set a bit or bit combination on bitmap
     * @param flags  bitmap to change
     * @param bit bits to set
     * @return updated bitmap with specified bits set
     */
    public static long setBit(long flags, long bit) {
        return flags | bit;
    }
}

Related

  1. setBit(int bits, int index)
  2. setBit(int changeValue, int position, int value)
  3. setBit(int data, int bit, int value)
  4. setBit(int f, int i)
  5. setBit(int flag, int i)
  6. setBit(int i, int bit, boolean enabled)
  7. setBit(int i, int bit, boolean state)
  8. setBit(int integer, int bit)
  9. setBit(int mask, int bit, boolean value)