Index massValuesIndex = massValueArray.getIndex();
Index intensityValuesIndex = intensityValueArray.getIndex();
int arrayLength = massValueArray.getShape()[0];
DataPoint completeDataPoints[] = new DataPoint[arrayLength];
for (int j = 0; j < arrayLength; j++) {
Index massIndex0 = massValuesIndex.set0(j);
Index intensityIndex0 = intensityValuesIndex.set0(j);
double mz = massValueArray.getDouble(massIndex0)
* massValueScaleFactor;
double intensity = intensityValueArray.getDouble(intensityIndex0)
* intensityValueScaleFactor;
completeDataPoints[j] = new SimpleDataPoint(mz, intensity);
}
scanNum++;
// Auto-detect whether this scan is centroided
boolean centroided = ScanUtils.isCentroided(completeDataPoints);
// Remove zero data points
DataPoint optimizedDataPoints[] = ScanUtils.removeZeroDataPoints(
completeDataPoints, centroided);
SimpleScan buildingScan = new SimpleScan(null, scanNum, 1,
retentionTime.doubleValue(), -1, 0, 0, null,
optimizedDataPoints, centroided);