public static String compressJs(String code) {
        InputStream inStream = new ByteArrayInputStream(code.getBytes());
        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
        JSMin jsmin = new JSMin(inStream, outStream);
        try {
            jsmin.jsmin();
            return outStream.toString().trim();
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
    }
public static String compressJs(String code) {
        InputStream inStream = new ByteArrayInputStream(code.getBytes());
        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
        JSMin jsmin = new JSMin(inStream, outStream);
        try {
            jsmin.jsmin();
            return outStream.toString().trim();
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
    }
public static String compressJs ( String code ) { InputStream inStream = new ByteArrayInputStream ( code . getBytes ( ) ) ; ByteArrayOutputStream outStream = new ByteArrayOutputStream ( ) ; JSMin jsmin = new JSMin ( inStream , outStream ) ; try { jsmin . jsmin ( ) ; return outStream . toString ( ) . trim ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return "" ; } }
Compress a JS-string

@param code the js-code you want to compress
@return the compressed code
Compress a JS - string