public List<Peak> normalizeSpectrum(List<Peak> spectrum) {
    if (spectrum.size() < 1) return spectrum;

    // get the max intensity
    Double maxIntensity = 0.0;
    for (Peak p : spectrum) {
      if (p.getIntensity() > maxIntensity) maxIntensity = p.getIntensity();
    }

    // if there's no suitable max intensity, return the unchanged spectrum
    if (maxIntensity <= 0) return spectrum;

    // calculate the ratio
    double ratio = highestPeakIntensity / maxIntensity;

    // create the new spectrum
    List<Peak> normalizedSpectrum = new ArrayList<Peak>(spectrum.size());

    for (Peak p : spectrum) {
      normalizedSpectrum.add(new Peak(p.getMz(), p.getIntensity() * ratio));
    }

    return normalizedSpectrum;
  }