Check if a number has two adjacent set bits | Java program to check if there are two adjacent set bits . ; Driver code
class GFG { static boolean adjacentSet ( int n ) { int x = ( n & ( n >> 1 ) ) ; if ( x > 0 ) return true ; else return false ; } public static void main ( String args [ ] ) { int n = 3 ; if ( adjacentSet ( n ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }