if (stringExpo(p)==""){
...
else {
result= result+stringCoef(p)+stringExpo(p);
if (stringExpo(p)==""){
Looks like the second if will always be false, since it's in an else clause following an if with the same test?
Plus, the old old chestnut, you can't compare Strings with == unless you actually mean "are exactly the same Object". Use string1.equals(string2) to test of they contain the same sequence of characters.