public boolean doInputParenthesesMatch(ArrayList<Character> parenPairsArray, String stringWithParens) {

        StringBuilder stringBuilderWithParens = new StringBuilder(stringWithParens);
        Stack<Character> parensStack = new Stack<Character>();

        // Look at each character in the string and individually handle
        // all of the parentheses characters
        for (int i = 0; i < stringBuilderWithParens.length(); i++) {
            Character thisChar = stringBuilderWithParens.charAt(i);

            for (int j = 0; j < parenPairsArray.size(); j++) {
                if ((j % 2 == 0) && thisChar.equals(parenPairsArray.get(j))) {
                    parensStack.push(thisChar);
                } else if ((j % 2 == 1) && thisChar.equals(parenPairsArray.get(j))) {
                    if (parensStack.empty() || parensStack.peek() != parenPairsArray.get(j-1)) {
                        return false;
                    } else {
                        parensStack.pop();
                    }
                }
            }
        }

        if (!parensStack.empty()) {
            return false;
        }

        return true;
    }