Flip consecutive set bits starting from LSB of a given number | Java program for the above approach ; Function to find the number after converting 1 s from end to 0 s ; Return the logical AND of N and ( N + 1 ) ; Driver Code ; Function Call
import java . util . * ; class GFG { static int findNumber ( int N ) { return N & ( N + 1 ) ; } public static void main ( String [ ] args ) { int N = 39 ; System . out . print ( findNumber ( N ) ) ; } }