public boolean getSum4Val(int[] vals, int sum) {
		// a > b > c > d
		// Following set contains all (c + d), where c < b < a and d < b < a.
		Set<Integer> set = new HashSet<Integer>();
		for (int b = 0; b < vals.length; b++) {
			// check if [sum - (a + b)] is in the set.
			for (int a = b + 1; a < vals.length; a++) { // a > b
				Integer key = sum - (vals[a] + vals[b]);
				if (set.contains(key))
					return true;
			}

			// update the set
			int c = b;
			for (int d = 0; d < c; d++) {
				set.add(vals[c] + vals[d]);
			}
		}
		return false;
	}