private String solvePower(String expression) throws Exception {

        //Splits expression by ^.
        String[] subExp = expression.split("(\\^)");

        //Solve left-most expression of the string.
        double value = Double.parseDouble(selectAndSolve(subExp[0]));

        //Solve other expressions and do operations with first value.
        for (int i = 1; i < subExp.length; i++) {
            //Raise left to power of rignt
            value = Math.pow(
                    value,
                    Double.parseDouble(selectAndSolve(subExp[i]))
            );
        }

        //Return solved sub expression.
        return String.valueOf(value);
    }