public static int threeSumClosest(int[] num, int target) {
		int[]A=num;
		int t=target;
		int rel=0, minval=Integer.MAX_VALUE;
		Arrays.sort(A);
		for (int i=0, n=A.length;i<n;++i) {
			for (int j=i+1, k=n-1; j<k;) {
				int s=A[i]+A[j]+A[k], val=Math.abs(s-t);
				if (minval>val) {
					rel=s;
					minval=val;
				}
				if (s==t) return rel;
				else if (s<t) ++j;
				else --k;
			}
		}
		return rel;
	}