[JAVA] Easy to understand
\nclass Solution {\n    public long smallestNumber(long num) {\n        if(num == 0){\n            return 0;\n        }\n        boolean isNegative = num < 0;\n
```\nclass Solution {\n    public long smallestNumber(long num) {\n        if(num == 0){\n            return 0;\n        }\n        boolean isNegative = num < 0;\n        num  = num < 0 ? num * -1 : num;\n        \n        char[] c = String.valueOf(num).toCharArray();\n        Arrays.sort(c);\n        String str;\n        if(!isNegative){\n            int non = 0;\n\t\t\t//if not negative we need to find out the first non-leading zero then swap with first zero\n            for(; non < c.length; non++){\n                if(c[non] != \'0\'){\n                    break;\n                }\n            }\n            char temp = c[non];\n            c[non] = c[0];\n            c[0] = temp;\n            str = new String(c);\n        }else{\n            str = new String(c);\n            StringBuilder sb = new StringBuilder(str);\n            str = "-".concat(sb.reverse().toString());\n        }\n        return Long.valueOf(str);\n    }\n}\n```
['Java']