cdm/src/main/java/ucar/ma2/ArrayStructure.java
public int convertScalarInt(int recnum, StructureMembers.Member m) {
    if (m.getDataType() == DataType.INT || m.getDataType() == DataType.UINT) return getScalarInt(recnum, m);
    if (m.getDataType() == DataType.SHORT) return (int) getScalarShort(recnum, m);
    if (m.getDataType() == DataType.USHORT) return DataType.unsignedShortToInt( getScalarShort(recnum, m));
    if (m.getDataType() == DataType.BYTE) return (int) getScalarByte(recnum, m);
    if (m.getDataType() == DataType.UBYTE) return (int) DataType.unsignedByteToShort( getScalarByte(recnum, m));
    if (m.getDataType() == DataType.LONG || m.getDataType() == DataType.ULONG) return (int) getScalarLong(recnum, m);
    Object o = getScalarObject(recnum, m);
    if (o instanceof Number) return ((Number) o).intValue();
    throw new ForbiddenConversionException("Type is " + m.getDataType() + ", not convertible to int");
  }
public int convertScalarInt(int recnum, StructureMembers.Member m) {
    if (m.getDataType() == DataType.INT || m.getDataType() == DataType.UINT) return getScalarInt(recnum, m);
    if (m.getDataType() == DataType.SHORT) return (int) getScalarShort(recnum, m);
    if (m.getDataType() == DataType.USHORT) return DataType.unsignedShortToInt( getScalarShort(recnum, m));
    if (m.getDataType() == DataType.BYTE) return (int) getScalarByte(recnum, m);
    if (m.getDataType() == DataType.UBYTE) return (int) DataType.unsignedByteToShort( getScalarByte(recnum, m));
    if (m.getDataType() == DataType.LONG || m.getDataType() == DataType.ULONG) return (int) getScalarLong(recnum, m);
    Object o = getScalarObject(recnum, m);
    if (o instanceof Number) return ((Number) o).intValue();
    throw new ForbiddenConversionException("Type is " + m.getDataType() + ", not convertible to int");
  }
Get scalar value as an int, with conversion as needed. Underlying type must be convertible to int.

@param recnum get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();
@param m      member Variable.
@return scalar double value
@throws ForbiddenConversionException if not convertible to double.