Here you can find the source of setBit(short shortIn, int bitPos)
public static short setBit(short shortIn, int bitPos)
//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*/ }