text: Given a HUGE number check if it 's a power of two. | Java program to find whether a number is power of 2 or not ; Function to check whether a number is power of 2 or not ; Driver code
code: class GfG { static long ispowerof2 ( long num ) { if ( ( num & ( num - 1 ) ) == 0 ) return 1 ; return 0 ; } public static void main ( String [ ] args ) { long num = 549755813888L ; System . out . println ( ispowerof2 ( num ) ) ; } }