Код: Выделить всё
public static double operatorSystem(double calculateExpression, String operator, double newTerm) {
switch (operator) {
case "-":
calculateExpression = calculateExpression - newTerm;
break;
case "+":
calculateExpression = calculateExpression + newTerm;
break;
case "*":
calculateExpression = calculateExpression * newTerm;
break;
case "/":
calculateExpression = calculateExpression / newTerm;
break;
case "^":
calculateExpression = Math.pow(calculateExpression, newTerm);
break;
default:
break;
}
return calculateExpression;
}
public static void main(String[] args) throws IOException {
String[] operations = {"-", "+", "*", "/", "^", "()"};
ArrayList expressionList = new ArrayList();
ArrayList stringExpressionList = new ArrayList();
ArrayList discreteExpressionList = new ArrayList();
ArrayList arithmeticExpressionList = new ArrayList();
ArrayList expressionArray = new ArrayList();
List allList = new ArrayList();
int input = read();
double calculateExpression = 0;
String stringExpression = "";
String arithmeticExpression = "";
String discreteExpression = "";
int counter = 0;
int termsAmount = 6;
for (int t = 1; t
Подробнее здесь: [url]https://stackoverflow.com/questions/79749828/ways-to-fix-exception-in-thread-main-java-lang-outofmemoryerror-java-heap-spa[/url]