Number of values of b such that a = b + ( a ^ b ) | Java program to find the number of values of b such that a = b + ( a ^ b ) ; function to return the number of solutions ; Driver Code
import java . io . * ; class GFG { static int countSolutions ( int a ) { int count = Integer . bitCount ( a ) ; count = ( int ) Math . pow ( 2 , count ) ; return count ; } public static void main ( String [ ] args ) { int a = 3 ; System . out . println ( countSolutions ( a ) ) ; } }