public boolean checkBrackets(String brackets) {
		char[] bracketsArray = brackets.toCharArray();
		Stack<Character> result = new Stack<Character>();
		int opening = 0;
		
		for (int i = 0; i < bracketsArray.length; i++) {
			if (result.empty()) {
				if (bracketsArray[i] == ')') {
					return false;
				} else {
					result.add(bracketsArray[i]);
					opening++;
				}
			} else {
				if (result.peek() == '(' && bracketsArray[i] == ')') {
					result.pop();
					opening--;
				} else {
					if (bracketsArray[i] == '(') {
						result.add(bracketsArray[i]);
						opening++;
					} else {
						return false;
					}
				}
			}
		}
		
		if (result.empty() && opening == 0) {
			return true;
		} else {
			return false;
		}
	}