Check whether the binary equivalent of a number ends with "001" or not | Java implementation of the above approach ; Function to check if binary equivalent of a number ends in "001" or not ; To check if binary equivalent of a number ends in "001" or not ; Driver code
class GFG { static boolean CheckBinaryEquivalent ( int N ) { return ( N - 1 ) % 8 == 0 ; } public static void main ( String [ ] args ) { int N = 9 ; if ( CheckBinaryEquivalent ( N ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }