cdm/src/main/java/ucar/nc2/iosp/IospHelper.java
static public Object makePrimitiveArray(int size, DataType dataType) {
    Object arr = null;

    if ((dataType.getPrimitiveClassType() == byte.class) || (dataType == DataType.CHAR) || (dataType == DataType.OPAQUE) || (dataType == DataType.STRUCTURE)) {
      arr = new byte[size];

    } else if (dataType.getPrimitiveClassType() == short.class) {
      arr = new short[size];

    } else if (dataType.getPrimitiveClassType() == int.class) {
      arr = new int[size];

    } else if (dataType.getPrimitiveClassType() == long.class) {
      arr = new long[size];

    } else if (dataType == DataType.FLOAT) {
      arr = new float[size];

    } else if (dataType == DataType.DOUBLE) {
      arr = new double[size];

   } else if (dataType == DataType.STRING) {
      arr = new String[size];
    }

    return arr;
  }
static public Object makePrimitiveArray(int size, DataType dataType) {
    Object arr = null;

    if ((dataType.getPrimitiveClassType() == byte.class) || (dataType == DataType.CHAR) || (dataType == DataType.OPAQUE) || (dataType == DataType.STRUCTURE)) {
      arr = new byte[size];

    } else if (dataType.getPrimitiveClassType() == short.class) {
      arr = new short[size];

    } else if (dataType.getPrimitiveClassType() == int.class) {
      arr = new int[size];

    } else if (dataType.getPrimitiveClassType() == long.class) {
      arr = new long[size];

    } else if (dataType == DataType.FLOAT) {
      arr = new float[size];

    } else if (dataType == DataType.DOUBLE) {
      arr = new double[size];

   } else if (dataType == DataType.STRING) {
      arr = new String[size];
    }

    return arr;
  }
static public Object makePrimitiveArray ( int size , DataType dataType ) { Object arr = null ; if ( ( dataType . getPrimitiveClassType ( ) == byte . class ) || ( dataType == DataType . CHAR ) || ( dataType == DataType . OPAQUE ) || ( dataType == DataType . STRUCTURE ) ) { arr = new byte [ size ] ; } else if ( dataType . getPrimitiveClassType ( ) == short . class ) { arr = new short [ size ] ; } else if ( dataType . getPrimitiveClassType ( ) == int . class ) { arr = new int [ size ] ; } else if ( dataType . getPrimitiveClassType ( ) == long . class ) { arr = new long [ size ] ; } else if ( dataType == DataType . FLOAT ) { arr = new float [ size ] ; } else if ( dataType == DataType . DOUBLE ) { arr = new double [ size ] ; } else if ( dataType == DataType . STRING ) { arr = new String [ size ] ; } return arr ; }
Create 1D primitive array of the given size and type

@param size     the size of the array to create
@param dataType dataType of the variable
@return primitive array with data read in
Create 1D primitive array of the given size and type