public static void main(String[] args) throws FileNotFoundException {
		File input = new File(args[0]);

		// get the size of the input file: count of rows and columns
		// assuming the input is not corrupted, i.e., a legal matrix
		Scanner scanner = new Scanner(input);
		String firstline = scanner.nextLine();
		int row_num = 1;
		int col_num = firstline.length();
		while (scanner.hasNextLine()) {
			row_num++;
			scanner.nextLine();
		}
		scanner.close();

		// initialize the matrix
		boolean[][] matrix = new boolean[row_num][col_num];
		Scanner scan = new Scanner(input);
		int row_ind = 0;
		while (scan.hasNextLine()) {
			String line = scan.nextLine();
			for (int col = 0; col < col_num; col++) {
				matrix[row_ind][col] = (line.charAt(col) != '0');
			}
			row_ind++;
		}
		scan.close();

		// find the first 1 occurrence:
		int top = -1;// to store the top position
		int ini_col = -1;
		loop: for (int row = 0; row < row_num; row++) {
			for (int col = 0; col < col_num; col++) {
				if (matrix[row][col]) {
					top = row;
					ini_col = col;
					break loop;
				}
			}
		}

		// when no blob exists
		if (top == -1) {
			System.out.println("No Blobs in the Matrix");
		} else {
			// to store positions of bottom, left and right
			int[] result = { -1, col_num, -1 };

			// recurse
			getBoundary(matrix, result, top, ini_col);
			System.out.print("Top: " + top + "\nBottom: " + result[0] + "\nLeft: " + result[1] + "\nRight: " + result[2]);
		}
	}