Here you can find the source of clearBitsAfterInLastWord(int lastWord, int lastSetBit)
public static int clearBitsAfterInLastWord(int lastWord, int lastSetBit)
//package com.java2s; //License from project: Apache License public class Main { /**// www . j av a 2 s . co m * Literal that represents all bits set to 0 (and MSB = 1) */ public final static int ALL_ZEROS_LITERAL = 0x80000000; public static int clearBitsAfterInLastWord(int lastWord, int lastSetBit) { return lastWord &= ALL_ZEROS_LITERAL | (0xFFFFFFFF >>> (31 - lastSetBit)); } }