Very easy Java solution. No Complex java library objects used
\nimport java.util.*;\nclass Solution {\n    char arr[];\n    int n;\n    public boolean isNull()\n    {\n        for(int i=0; i<n; i++)\n            if(arr[i]!
```\nimport java.util.*;\nclass Solution {\n    char arr[];\n    int n;\n    public boolean isNull()\n    {\n        for(int i=0; i<n; i++)\n            if(arr[i]!=\'0\')\n                return false;\n        return true;\n    }\n    public String sortString(String s) \n    {\n        arr = s.toCharArray();\n        Arrays.sort(arr);\n        n = s.length();\n        String res="";\n        while(!isNull())\n        {\n            char ref=\'0\';\n            for(int i=0; i<n; i++)\n            {\n                char temp = arr[i];\n                if(temp !=\'0\')\n                {\n                    if(ref==\'0\')\n                    {\n                        res+=temp;\n                        ref = temp;\n                        arr[i]=\'0\';\n                    }\n                    else if(temp>ref)\n                    {\n                        res+=temp;\n                        ref = temp;\n                        arr[i]=\'0\';\n                    }\n                        \n                }\n            }\n            // System.out.println(res);\n            char ref1=\'0\';\n            for(int j=n-1; j>=0; j--)\n            {\n                char temp = arr[j];\n                if(temp!=\'0\')\n                {\n                    if(ref1==\'0\')\n                    {\n                        res+=temp;\n                        ref1 = temp;\n                        arr[j]=\'0\';\n                    }\n                    else if(temp<ref1)\n                    {\n                        res+=temp;\n                        ref1 = temp;\n                        arr[j]=\'0\';\n                    }\n                }\n            }\n            // System.out.println(res);\n        }\n        return res;\n    }\n}\n\n//By Arindam Ghosh\n```
['Java']