Turn off the rightmost set bit | Java program to unset the rightmost set bit of an integer . ; unsets the rightmost set bit of n and returns the result ; Driver code
class GFG { static int fun ( int n ) { return n & ( n - 1 ) ; } public static void main ( String arg [ ] ) { int n = 7 ; System . out . print ( " The ▁ number ▁ after ▁ unsetting ▁ " + " the ▁ rightmost ▁ set ▁ bit ▁ " + fun ( n ) ) ; } }