I want to create a method in Java that receives a string equation, for example: "3+2" or "32-1/3" or even "min(32,21)" and returns the result I have found ScriptEngine that offers the solution for simple operations :
ScriptEngineManager mgr = new ScriptEngineManager();
ScriptEngine engine = mgr.getEngineByName("JavaScript");
java.lang.String result;
result = engine.eval(equation).toString();
But it has no min(),max() functionality, and also it's not secure because you can input malicious scripts through.