import numpy as np # Import the NumPy library and give it an alias "np"
# Define an integer NumPy array with values 1, 2, 3, 4.
int_vector = np.array([1, 2, 3, 4])
# Define a NumPy array with binary values 1000, 0100, 0010, 0001.
mask = np.array([8, 4, 2, 1])
# Perform a bitwise AND operation between each element of the int_vector
# and mask. Then convert the resulting boolean array to an integer array with 1s and 0s.
binary_matrix = np.bitwise_and(int_vector[:, None], mask) > 0
# Reshape the 1D binary matrix into a 2D matrix with 4 columns
# and as many rows as needed. Also, change the data type to integer.
binary_matrix = binary_matrix.reshape(-1, 4).astype(int)
# Print the final binary matrix.
print(binary_matrix)