Java Bit Mask bitMask(int bit)

Here you can find the source of bitMask(int bit)

Description

Calculate a bitmask of the bit.

License

Apache License

Parameter

Parameter Description
bit The bit to be used to calculate the bitmask.

Return

The value of the bitmask.

Declaration

public static int bitMask(int bit) 

Method Source Code

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

public class Main {
    /**/*from w  w w  . j  a va 2 s  . com*/
     * Calculate a bitmask of the bit.
     * @param bit The bit to be used to calculate the bitmask.
     * @return The value of the bitmask.
     */
    public static int bitMask(int bit) {
        assert bit >= 0 && bit < 16;
        return 1 << bit;
    }
}

Related

  1. bitMask(final int numberOfBits)
  2. bitMask(int bitSize)
  3. bitMask(int i)