private void convertScaleOffsetUnsignedInt(IndexIterator iterIn, IndexIterator iterOut) {
   boolean checkMissing = useNaNs && hasMissing();
   while (iterIn.hasNext()) {
     int valb = iterIn.getIntNext();
     double val = scale * DataType.unsignedIntToLong(valb) + offset;
     iterOut.setDoubleNext(checkMissing && isMissing_(val) ? Double.NaN : val);
   }
 }
 private static void putArrayData(IndexIterator ii, DataType dataType, Number data) {
   switch (dataType) {
     case INT:
       ii.setIntNext(data.intValue());
       break;
     case LONG:
       ii.setLongNext(data.longValue());
       break;
     case FLOAT:
       ii.setFloatNext(data.floatValue());
       break;
     case DOUBLE:
       ii.setDoubleNext(data.doubleValue());
       break;
   }
 }
  /**
   * Convert Data with scale and offset. Also translate missing data to NaNs if useNaNs = true.
   *
   * @param in data to convert
   * @return converted data.
   */
  private Array convertScaleOffset(Array in) {
    if (!hasScaleOffset) return in;
    if (debugRead) System.out.println("convertScaleOffset ");

    Array out = Array.factory(convertedDataType.getPrimitiveClassType(), in.getShape());
    IndexIterator iterIn = in.getIndexIterator();
    IndexIterator iterOut = out.getIndexIterator();

    if (isUnsigned && in.getElementType() == byte.class)
      convertScaleOffsetUnsignedByte(iterIn, iterOut);
    else if (isUnsigned && in.getElementType() == short.class)
      convertScaleOffsetUnsignedShort(iterIn, iterOut);
    else if (isUnsigned && in.getElementType() == int.class)
      convertScaleOffsetUnsignedInt(iterIn, iterOut);
    else {
      boolean checkMissing = useNaNs && hasMissing();
      while (iterIn.hasNext()) {
        double val = scale * iterIn.getDoubleNext() + offset;
        iterOut.setDoubleNext(checkMissing && isMissing_(val) ? Double.NaN : val);
      }
    }

    return out;
  }