In Java, is it possible to clear a bit?

bit-manipulation, java

Solution

yes, using

bits & ~(1 << n) 

where bits is an int/long and n is the n-th bit to be cleared.

(this is a useful blog post: low level bit hacks you absolutely must know)

Problem

In Java, is it possible to clear a bit using bitwise operations?

Original source