public static <T> boolean equals(T[][] matrix, T[][] withMatrix)
			throws NullPointerException {
		if (matrix == withMatrix)
			return true;

		if (matrix == null && withMatrix == null)
			return true;

		if (matrix == null || withMatrix == null)
			return false;

		int width = getWidth(matrix);
		int height = getHeight(matrix);
		if (width != getWidth(withMatrix) && height != getHeight(withMatrix))
			return false;

		for (int i = 0; i < width; i++) {
			if (!Arrays.equals(matrix[i], withMatrix[i]))
				return false;
		}

		return true;
	}