code: protected int mapRawNumToInternalScanNum(int spectrumIndex) throws FileParsingException {
      MZMLIndexElement byRawNum = index.getByRawNum(spectrumIndex);
      if (byRawNum == null) {
        String msg = String.format("Could not find a mapping from spectrum index"
                + " ref to an internal scan number for"
                + "\n\t file: %s"
                + "\n\t spectrum index searched for: #%d"
                + "\n\t spectrum index of the spectrum in which the error occured: #%d"
            , source.getPath(), spectrumIndex, vars.spectrumIndex);
        throw new FileParsingException(msg);
      }
      return byRawNum.getNumber();
    }
docs: Given a scan internal number (spectrum index) goes to the index and tries to find a mapping.