<\/span><\/h2>\n\n\n\nYou are given a class Solution and an inner class Inner.Private<\/code>. The main method of class Solution takes an integer num <\/em><\/strong>as input. The powerof2 in class Inner.Private<\/code> checks whether a number is a power of . You have to call the method powerof2 of the class Inner.Private <\/code>from the main method of the class Solution.<\/p>\n\n\n\n<\/span>Constraints<\/strong><\/span><\/h4>\n\n\n\n1 <= num <= 230<\/sup><\/strong><\/p>\n\n\n\n<\/span>Sample Input<\/strong><\/span><\/h4>\n\n\n\n 8<\/code><\/pre>\n\n\n\n<\/span>Sample Output<\/strong><\/span><\/h4>\n\n\n\n 8 is power of 2\n An instance of class: Solution.Inner.Private has been created<\/code><\/pre>\n\n\n\n<\/span>Solution – Can You Access?<\/strong> in Java<\/strong><\/span><\/h2>\n\n\n\nimport java.io.*;\nimport java.lang.reflect.*;\nimport java.util.*;\nimport java.util.regex.*;\nimport java.security.*;\n\n\npublic class Solution {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tDoNotTerminate.forbidExit();\t\n\n\t\ttry{\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tint num = Integer.parseInt(br.readLine().trim());\n\t\t\tObject o;\/\/ Must be used to hold the reference of the instance of the class Solution.Inner.Private\n System.out.println(num + \" is \" + ((Inner.Private) (o = new Inner().new Private())).powerof2(num));\n\t\tSystem.out.println(\"An instance of class: \" + o.getClass().getCanonicalName() + \" has been created\");\n\t\t\n\t\t}\/\/end of try\n\t\t\n\t\tcatch (DoNotTerminate.ExitTrappedException e) {\n\t\t\tSystem.out.println(\"Unsuccessful Termination!!\");\n\t\t}\n\t}\/\/end of main\n\tstatic class Inner{\n\t\tprivate class Private{\n\t\t\tprivate String powerof2(int num){\n\t\t\t\treturn ((num&num-1)==0)?\"power of 2\":\"not a power of 2\";\n\t\t\t}\n\t\t}\n\t}\/\/end of Inner\n\t\n}\/\/end of Solution\n\nclass DoNotTerminate { \/\/This class prevents exit(0)\n\t \n public static class ExitTrappedException extends SecurityException {\n\n\t\tprivate static final long serialVersionUID = 1L;\n }\n \n public static void forbidExit() {\n final SecurityManager securityManager = new SecurityManager() {\n @Override\n public void checkPermission(Permission permission) {\n if (permission.getName().contains(\"exitVM\")) {\n throw new ExitTrappedException();\n }\n }\n };\n System.setSecurityManager(securityManager);\n }\n}\t<\/pre>\n\n\n\n