If you need a math parser, you can find one implemented for Java, Delphi, VC++ (COM), .NET at http://www.bestcode.com. It includes source code so you can take a look too.
There is a set of Java classes called JbcParser:
JbcParser features include:
Easy to use, simple class API.
Comes with predefined functions.
Users can create custom functions/variables.
Function/variable names start with letters and can contain letters, numbers and 齙?
Optimization: Constant expression elimination for repeated tasks.
Operators: +, -, /, *, ^
Boolean Operators: <, >, =, &, |, ! ,<>, >=, <=
Paranthesis: (, {, [
Functions in the form of: f(x,y,z, ...)
Function parameter calculations are only done if needed.
List of predefined functions is available in the documentation.
Provides localization support.
Source code is included.
Then for example, your code can evaluate a string expression like: "( [ SIN(X)^2 ] + COS(1) ) * PI/2"
It is at: http://www.bestcode.com/html/jbcparser.html
Regards,