If the formulas are not too complex you could try to use a JavaScript engine. See
http://download.oracle.com/javase/6/docs/technotes/guides/scripting/programmer_guide/index.html for more information.
Edit: I just tried it, and it can handle a * b just fine:
The max function is undefined in JavaScript however. You can solve that by adding it as a function after line 8:
You may want to add a few similar functions like that, like min.
Also, the eval method returns a Double, but the cast to Number and then calling its intValue() method is a bit safer to get the int result.