So here is something i am trying to do:
1.Store a mathematical expression eg. 23*32+12 in the String datatype.
2.Now i have to calculate the value of that expression.
So i thought of converting the string to integer using parseInt , but for this the string need not contain *,+ and other operators.So how can i calculate the value of that expression?

with the indexOf method, you'll be able to detect where there are mathematical symbols, such as * + /
next, use the substring method, to divide the String you have, and run the Integer.parseInt method on the substrings you've found.
but make sure you only have non-decimal numbers, otherwise, an int won't give you the correct result.

with the indexOf method, you'll be able to detect where there are mathematical symbols, such as * + /
next, use the substring method, to divide the String you have, and run the Integer.parseInt method on the substrings you've found.
but make sure you only have non-decimal numbers, otherwise, an int won't give you the correct result.

using this i am getting the result but now i am having one problem:
The result is calculated in linear fashion instead i want it to follow BODMAS rule while
computing the value.
For eg my string is=221+33*123+3
so the code does this:
221+33=254
254*123=31242
31242+3=31245
So the result is 31245
now if i have to follow bodmas it should be:
33*123=4059
and then it should add 221 and 3,so the result would be 4283.
So how should i achieve this?