Woodall Number | JAVA program to check if a number is Woodall or not . ; If number is even , return false . ; If x is 1 , return true . ; While x is divisible by 2 ; Divide x by 2 ; Count the power ; If at any point power and x became equal , return true . ; Driven Program
class GFG { static boolean isWoodall ( int x ) { if ( x % 2 == 0 ) return false ; if ( x == 1 ) return true ; int p = 0 ; while ( x % 2 == 0 ) { x = x / 2 ; p ++ ; if ( p == x ) return true ; } return false ; } public static void main ( String args [ ] ) { int x = 383 ; if ( isWoodall ( x ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }