Check if a pair of integers from two ranges exists such that their Bitwise XOR exceeds both the ranges | Java program for the above approach ; Function to check if there exists any pair ( P , Q ) whose Bitwise XOR is greater than the Bitwise XOR of X and Y ; Check for the invalid condition ; Otherwise , ; Driver code
import java . lang . * ; import java . util . * ; class GFG { static void findWinner ( int X , int Y ) { int first = ( X ^ Y ) ; int second = ( X + Y ) ; if ( first == second ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } public static void main ( String [ ] args ) { int A = 2 , B = 4 ; findWinner ( A , B ) ; } }