private int calculateNumElements(AbstractArrayMsType type, DataType underlyingDataType) {

		if (underlyingDataType == null) {
			// TODO: test and clean up... can this happen?
			underlyingDataType = Undefined1DataType.dataType;
			String msg = "PDB Type index " + type.getRecordNumber().getNumber() +
				":\n   Null underlying data type for " + type.getClass().getSimpleName() +
				":\n      " + type.getName() + "\n   Using " + underlyingDataType;
			Msg.warn(this, msg);
		}

		long longUnderlyingSize = underlyingDataType.getLength();

		if (longUnderlyingSize > Integer.MAX_VALUE) {
			String msg = "PDB " + type.getClass().getSimpleName() + ": Underlying type too large " +
				underlyingDataType.getName();
			Msg.warn(this, msg);
			underlyingDataType = Undefined1DataType.dataType;
			longUnderlyingSize = 1L;
		}
		else if (longUnderlyingSize == 0L) {
			longUnderlyingSize = 1L;
		}

		long longArraySize = getSizeLong(type);
		long longNumElements = longArraySize / longUnderlyingSize;

		if (longNumElements > Integer.MAX_VALUE) {
			String msg = "PDB " + type.getClass().getSimpleName() +
				": Array num elements too large: " + longUnderlyingSize;
			Msg.warn(this, msg);
			longNumElements = 1L;
		}
		else if (longArraySize == 0) {
			//flexible array
			longNumElements = 0L;
		}
		else if (longArraySize % longUnderlyingSize != 0L) {
			String msg = "PDB " + type.getClass().getSimpleName() +
				": Array num elements calculation error underlying type " + longArraySize + " % " +
				longUnderlyingSize;
			Msg.warn(this, msg);
			// bad calculation.  Underlying type does not evenly fit into array total size.
			return -1;
		}

		int numElements = (int) longNumElements;

		return numElements;
	}
Constructor for the applicator that applies a "array" type, transforming it into a
Ghidra DataType
@param applicator {@link DefaultPdbApplicator} for which this class is working
Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/ArrayTypeApplier.java