JexlEngine engine = new JexlEngine(); String rule = "A+B+C*(3*2)-4"; Expression expression = engine.createExpression(rule); MapContext context = new MapContext(); context.set("A", 978); context.set("B", 508); context.set("C", 444); float number = Float.parseFloat(expression.evaluate(context).toString()); Log.i("Math to String", number + ""); Output: 4146.0