<awangdev>Backpack_4.java
public int backPack(int m, int[] A) {
    	if (A == null || A.length < 0) {
    	    return 0;
    	}
    	int n = A.length;
    	boolean[][] dp = new boolean[2][m + 1];
    	int curr = 0;
    	int pre = 1;
    	dp[curr][0] = true;
    	for (int j = 1; j <= m; j++) {
    	    dp[curr][j] = false;
    	}
    	
    	for (int i = 1; i <= n; i++) {
    	    curr = pre;
    	    pre = 1 - curr;
    	    for (int j = 0; j <= m; j++) {
    	        dp[curr][j] = dp[pre][j];
    	        if (j - A[i - 1] >= 0) { 
    	            dp[curr][j] |= dp[pre][j - A[i - 1]]; 
    	        }
    	    }
    	}
    	
    	for (int j = m; j >= 0; j--) {
    	    if (dp[curr][j]) {
    	        return j;
    	    }
    	}
    	return 0;
    }
public int sample_funcname ( int var_0 , int [ ] var_1 ) {
  if ( var_1 == null || var_1 . length < 0 ) {
    return 0 ;
  }
  int var_5 = var_1 . length ;
  boolean [ ] [ ] var_9 = new boolean [ 2 ] [ var_0 + 1 ] ;
  int var_10 = 0 ;
  int var_11 = 1 ;
  var_9 [ var_10 ] [ 0 ] = true ;
  for ( int var_12 = 1 ;
  var_12 <= var_0 ;
  var_12 ++ ) {
    var_9 [ var_10 ] [ var_12 ] = false ;
  }
  for ( int var_13 = 1 ;
  var_13 <= var_5 ;
  var_13 ++ ) {
    var_10 = var_11 ;
    var_11 = 1 - var_10 ;
    for ( int var_12 = 0 ;
    var_12 <= var_0 ;
    var_12 ++ ) {
      var_9 [ var_10 ] [ var_12 ] = var_9 [ var_11 ] [ var_12 ] ;
      if ( var_12 - var_1 [ var_13 - 1 ] >= 0 ) {
        var_9 [ var_10 ] [ var_12 ] |= var_9 [ var_11 ] [ var_12 - var_1 [ var_13 - 1 ] ] ;
      }
    }
  }
  for ( int var_12 = var_0 ;
  var_12 >= 0 ;
  var_12 -- ) {
    if ( var_9 [ var_10 ] [ var_12 ] ) {
      return var_12 ;
    }
  }
  return 0 ;
}
