- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
// определяем приоритет операций
private int getPriority(char currentCharacter){
if (Character.isLetter(currentCharacter)) return 4;
else if (currentCharacter =='*'|| currentCharacter=='/') return 3;
else if (currentCharacter == '+'|| currentCharacter=='-') return 2;
else if (currentCharacter == '(') return 1;
else if (currentCharacter ==')') return -1;
else return 0;
}