public boolean containsNearbyAlmostDuplicate(int[] nums, int k, int t) {
		if (nums.length < 2 || k < 1 || t < 0)
			return false;
		ValuePosPair[] valPosArr = new ValuePosPair[nums.length];
		for (int i = 0; i < nums.length; i++)
			valPosArr[i] = new ValuePosPair(nums[i], i);
		Arrays.sort(valPosArr);
		for (int i = 0; i < valPosArr.length; i++) {
			for (int j = i + 1; j < valPosArr.length
					&& ((long) valPosArr[j].val - (long) valPosArr[i].val <= (long) t); j++) {
				if (Math.abs(valPosArr[j].pos - valPosArr[i].pos) <= k)
					return true;
			}
		}
		return false;
	}