private int simplify(int operationPosition, float result) {
        int start = operationPosition;
        if (start > 0) {
            do {
                if (isInt(equation.charAt(start - 1)) || isDot(equation.charAt(start - 1))) {
                    start--;
                } else if (equation.charAt(start - 1) == '-' || equation.charAt(start - 1) == '+') {
                    start--;
                    break;
                }
            } while ((start - 1) >= 0);
        }

        int end = operationPosition + 1;
        do {
            if (isInt(equation.charAt(end)) || isDot(equation.charAt(end)))
                end++;
            else
                break;
        } while(end < equation.length());

        equation = equation.substring(0, start) + toStringWithSign(result) + equation.substring(end, equation.length());

        return (equation.substring(0, start) + toStringWithSign(result)).length();

    }