public int longestConsecutive(int[] num) {
			int longest = 0;
			Set<Integer> pastData = new HashSet<Integer>();

			for (int data : num) {
				pastData.add(data);
			}

			for (int data : num) {
				int curLong = 1;
				int cur = data;
				while (pastData.contains(++cur)) {
					pastData.remove(cur);
					curLong++;
				}

				cur = data;
				while (pastData.contains(--cur)) {
					pastData.remove(cur);
					curLong++;
				}

				longest = Math.max(curLong, longest);
			}
			return longest;
		}