└── Integer to String /Integer to String: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | import java.security.*; 3 | public class Solution { 4 | public static void main(String[] args) { 5 | 6 | DoNotTerminate.forbidExit(); 7 | 8 | try { 9 | Scanner in = new Scanner(System.in); 10 | int n = in .nextInt(); 11 | in.close(); 12 | String s=Integer.toString(n); 13 | 14 | if (n == Integer.parseInt(s)) { 15 | System.out.println("Good job"); 16 | } else { 17 | System.out.println("Wrong answer."); 18 | } 19 | } catch (DoNotTerminate.ExitTrappedException e) { 20 | System.out.println("Unsuccessful Termination!!"); 21 | } 22 | } 23 | } 24 | 25 | class DoNotTerminate { 26 | 27 | public static class ExitTrappedException extends SecurityException { 28 | 29 | private static final long serialVersionUID = 1; 30 | } 31 | 32 | public static void forbidExit() { 33 | final SecurityManager securityManager = new SecurityManager() { 34 | @Override 35 | public void checkPermission(Permission permission) { 36 | if (permission.getName().contains("exitVM")) { 37 | throw new ExitTrappedException(); 38 | } 39 | } 40 | }; 41 | System.setSecurityManager(securityManager); 42 | } 43 | } 44 | --------------------------------------------------------------------------------