text: Turn off the rightmost set bit | Set 2 | Java program to unset the rightmost set bit ; Unsets the rightmost set bit of n and returns the result ; Driver Code
code: import java . util . * ; class GFG { static int FlipBits ( int n ) { return n -= ( n & ( - n ) ) ; } public static void main ( String [ ] args ) { int N = 12 ; System . out . print ( " The ▁ number ▁ after ▁ unsetting ▁ the ▁ " ) ; System . out . print ( " rightmost ▁ set ▁ bit : ▁ " + FlipBits ( N ) ) ; } }