Apocalyptic Number | Java program for the above approach ; Function to check if a number N is Apocalyptic ; Driver Code ; Given Number N ; Function Call
class GFG { static boolean isApocalyptic ( int n ) { if ( String . valueOf ( ( Math . pow ( 2 , n ) ) ) . contains ( "666" ) ) return true ; return false ; } public static void main ( String [ ] args ) { int N = 157 ; if ( isApocalyptic ( N ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }