Java too much code inside
\nclass Solution {\n    public long smallestNumber(long num) {\n        if (num == 0) return num;\n        if (num < 0) {\n            List<Long> list = new Arr
```\nclass Solution {\n    public long smallestNumber(long num) {\n        if (num == 0) return num;\n        if (num < 0) {\n            List<Long> list = new ArrayList<>();\n            num *= -1;\n            while (num != 0) {\n                list.add(num % 10);\n                num /= 10;\n            }\n            Collections.sort(list);\n            Collections.reverse(list);\n            String ans = "";\n            for (int i = 0; i < list.size(); i++) {\n                ans += list.get(i);\n            }\n            return -1 * Long.valueOf(ans);\n        } else {\n            List<Long> list = new ArrayList<>();\n            String str = ""+num;\n            boolean isZero = false;\n            for (int i = 0; i < str.length(); i++) {\n                if (str.charAt(i) - \'0\' == 0) isZero = true;\n            }\n            \n             if (!isZero) {\n                  while (num != 0) {\n                  list.add(num % 10);\n                  num /= 10;\n                }\n                Collections.sort(list);\n                String ans = "";\n                for (int i = 0; i < list.size(); i++) {\n                    ans += list.get(i);\n                }\n                return Long.valueOf(ans);\n            } else {\n                 while (num != 0) {\n                  list.add(num % 10);\n                  num /= 10;\n                }\n                Collections.sort(list);\n                char[] ch = new char[list.size()];\n                 str = "";\n                for (int i = 0; i < list.size(); i++) {\n                    str += list.get(i);\n                }\n                 for (int i = 0; i < str.length(); i++) {\n                    ch[i] = (char) str.charAt(i);\n                } \n                 \n                int i = 0; \n                int j = 0; \n                while (j < ch.length && ch[j] == \'0\') {\n                    j++;\n                }\n                 System.out.println(j);\n                 char c = ch[0];\n                 ch[0] = ch[j];\n                 ch[j] = c;\n                   // System.out.println(Arrays.toString(ch));\n\n                str = String.valueOf(ch);\n                return Long.valueOf(str);\n            }\n        }\n    }\n}\n```
['Java']