1 import javax.script.ScriptEngine; 2 import javax.script.ScriptEngineManager; 3 4 public String Count(String s) throws ScriptException{ 5 ScriptEngineManager sem=new ScriptEngineManager(); 6 ScriptEngine se=sem.getEngineByName("JavaScript"); 7 System.out.println(se.eval(s).toString()); 8 return se.eval(s).toString(); 9 10 }