<awangdev>Triangle Count_2.java
public int triangleCount(int S[]) {
    	if (S == null || S.length == 0) {
    		return 0;
    	}
    	Arrays.sort(S);
    	int count = 0;
    	for (int i = 0; i < S.length; i++) {
    		int left = 0;
    		int right = i - 1; 
    		while (left < right){
    			if (S[left] + S[right] > S[i]) {
	    			count += (right - left);
	    			right--;
	    		} else {
	    			left++;
	    		}
    		}
    	}
    	return count;
    }
public int sample_funcname ( int var_0 [ ] ) {
  if ( var_0 == null || var_0 . length == 0 ) {
    return 0 ;
  }
  Arrays . sort ( var_0 ) ;
  int var_6 = 0 ;
  for ( int var_7 = 0 ;
  var_7 < var_0 . length ;
  var_7 ++ ) {
    int var_8 = 0 ;
    int var_10 = var_7 - 1 ;
    while ( var_8 < var_10 ) {
      if ( var_0 [ var_8 ] + var_0 [ var_10 ] > var_0 [ var_7 ] ) {
        var_6 += ( var_10 - var_8 ) ;
        var_10 -- ;
      }
      else {
        var_8 ++ ;
      }
    }
  }
  return var_6 ;
}
