<awangdev>Longest Consecutive Sequence_1.java
public int longestConsecutive(int[] nums) {
        if (nums == null || nums.length == 0) {
            return 0;
        }
        Set<Integer> set = new HashSet<>();
        for (int num : nums) {
            set.add(num);
        }
        
        int longest = 0;
        for (int num : nums) {
            int start = num;
            while (set.contains(start - 1)) {
                start--;
                set.remove(start);
            }
            
            int end = num;
            while (set.contains(end + 1)) {
                end++;
                set.remove(end);
            }
            longest = Math.max(longest, end - start + 1);
        }
        return longest;
    }
public int sample_funcname ( int [ ] var_0 ) {
  if ( var_0 == null || var_0 . length == 0 ) {
    return 0 ;
  }
  Set < Integer > var_7 = new HashSet < > ( ) ;
  for ( int var_8 : var_0 ) {
    var_7 . add ( var_8 ) ;
  }
  int var_10 = 0 ;
  for ( int var_8 : var_0 ) {
    int var_11 = var_8 ;
    while ( var_7 . contains ( var_11 - 1 ) ) {
      var_11 -- ;
      var_7 . remove ( var_11 ) ;
    }
    int var_15 = var_8 ;
    while ( var_7 . contains ( var_15 + 1 ) ) {
      var_15 ++ ;
      var_7 . remove ( var_15 ) ;
    }
    var_10 = Math . max ( var_10 , var_15 - var_11 + 1 ) ;
  }
  return var_10 ;
}
