public static int maximalRectangle(char[][] matrix) {
    	int n = matrix.length;
    	if(n == 0) {
    		return 0;
    	}
    	int m = matrix[0].length;
    	if(m == 0) {
    		return 0;
    	}
    	int[][] rectangleMatrix = new int[n][m];
    	for(int i=0;i<m;i++) {
    		rectangleMatrix[0][i] = Integer.valueOf(matrix[0][i])-48;
    	}
    	for(int j=1;j<n;j++) {
    		for(int i=0;i<m;i++) {
        		if(Integer.valueOf(matrix[j][i]) == 48) {
        			rectangleMatrix[j][i] = 0;
        		}else {
        			rectangleMatrix[j][i] = rectangleMatrix[j-1][i] + 1; 
        		}
        	}
    	}
    	
    	int max = 0;
    	for(int j=0;j<n;j++) {
    		int tmp = maximalInRow(rectangleMatrix[j], m);
    		if(tmp > max) {
    			max = tmp;
    		}
    	}
    	return max;
    	
    }