private void replaceZeros(int matrix[][])
	{
		boolean rows[] = new boolean[matrix.length];
		boolean columns[] = new boolean[matrix[0].length];
		
		//find all 0 positions first
		for(int i = 0; i < matrix.length; i++)
		{
			for(int j = 0; j <matrix[i].length; j++)
			{
				// store the row, column position
				if(matrix[i][j] == 0)
					rows[i] = columns[j] = true;				
			}
		}
		
		//replace all rows and columns
		for(int i = 0; i < matrix.length; i++)
		{
			for(int j = 0; j < matrix[i].length; j++)
			{
				if(rows[i] || columns[j])				
					matrix[i][j] = 0;			
			}
		}
	}