<awangdev>Longest Common Substring_2.java
public int longestCommonSubstring(String A, String B) {
    	if (A == null || B == null || A.length() == 0 || B.length() == 0) {
    		return 0;
    	}
    	int m = A.length();
    	int n = B.length();
    	int[][] dp = new int[2][n + 1];
    	int max = 0;
    	for (int i = 0; i <= m; i++) {
    		for(int j = 0; j <= n; j++) {
    		    if (i == 0 || j == 0) {
    		        dp[i % 2][j] = 0;
    		        continue;
    		    }
    			if (A.charAt(i - 1) == B.charAt(j - 1)) {
    				dp[i % 2][j] = dp[(i - 1) % 2][j - 1] + 1;
    			} else {
    				dp[i % 2][j] = 0;
    			}
        		max = Math.max(max, dp[i % 2][j]);
    		}
    	}
    	return max;
    }
public int sample_funcname ( String var_1 , String var_2 ) {
  if ( var_1 == null || var_2 == null || var_1 . length ( ) == 0 || var_2 . length ( ) == 0 ) {
    return 0 ;
  }
  int var_6 = var_1 . length ( ) ;
  int var_7 = var_2 . length ( ) ;
  int [ ] [ ] var_10 = new int [ 2 ] [ var_7 + 1 ] ;
  int max = 0 ;
  for ( int var_12 = 0 ;
  var_12 <= var_6 ;
  var_12 ++ ) {
    for ( int var_13 = 0 ;
    var_13 <= var_7 ;
    var_13 ++ ) {
      if ( var_12 == 0 || var_13 == 0 ) {
        var_10 [ var_12 % 2 ] [ var_13 ] = 0 ;
        continue ;
      }
      if ( var_1 . charAt ( var_12 - 1 ) == var_2 . charAt ( var_13 - 1 ) ) {
        var_10 [ var_12 % 2 ] [ var_13 ] = var_10 [ ( var_12 - 1 ) % 2 ] [ var_13 - 1 ] + 1 ;
      }
      else {
        var_10 [ var_12 % 2 ] [ var_13 ] = 0 ;
      }
      max = Math . max ( max , var_10 [ var_12 % 2 ] [ var_13 ] ) ;
    }
  }
  return max ;
}
