For this Question: Given a binary matrix, your task is to calculate the maximum area of a rectangle formed by only 1's in it.First line contains two integers number of rows N and number of columns M.
Next N lines contain M integers with each integer being either 0 or 1

Constraints:-
1 <= N, M <=1000Print the maximum area of rectangle.Sample Input 1:
4 4 
0 1 1 0 
1 1 1 1 
1 1 1 1 
1 1 0 0

Sample Output 1:
8

Explanation
The max size rectangle is 
1 1 1 1
1 1 1 1
and its area is 4*2 = 8

Sample Input 2:-
1 4
1 1 1 1

Sample Output 2:-
4, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main { static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
	public static void main (String[] args) {
        FastReader sc = new FastReader();
		int n = sc.nextInt();int m = sc.nextInt();
		char a[][] = new char[n][m];
		for(int i=0;i<n;i++){for(int j=0;j<m;j++){
			a[i][j] = sc.next().charAt(0);
		}}
       System.out.println(findRectangleArea2Ds(a));
	}
	private static int findRectangleArea2Ds(char[][] matrix) {
		if (matrix == null || matrix.length == 0) {
			return 0;
		}
		int maxArea = 0;
		int rows = matrix.length;
		int cols = matrix[0].length;
		int[][] dp = new int[rows][cols];
		for (int i = 0; i < rows; i++) {
			for (int j = 0; j < cols; j++) {
				if (matrix[i][j] == '1') {
					dp[i][j] = j == 0 ? 1 : dp[i][j - 1] + 1;
					int length = dp[i][j];

					for (int k = i; k >= 0; k--) {
						length = Math.min(length, dp[k][j]);
						int width = i - k + 1;
						maxArea = Math.max(maxArea, length * width);
					}
				}
			}
		}

		return maxArea;
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?