code: private static float calculateExtinctionFromPeptide(List<Monomer> monomers) throws IOException, HELM2HandledException {
  
      if (null == monomers || monomers.isEmpty()) {
        return 0.0f;
      }
  
      Map<String, Integer> countMap = new HashMap<String, Integer>();
      for (Monomer monomer : monomers) {
        if (aminoAcidMap.containsKey(monomer.getAlternateId())) {
          int count = 1;
          if (countMap.containsKey(monomer.getAlternateId())) {
            count = count + countMap.get(monomer.getAlternateId());
          }
          countMap.put(monomer.getAlternateId(), count);
        }
      }
  
      float result = 0.0f;
      Set<String> keys = countMap.keySet();
      for (Iterator<String> it = keys.iterator(); it.hasNext();) {
        String key = it.next();
        int count = countMap.get(key);
        float factor = aminoAcidMap.get(key);
        result = result + factor * count;
      }
  
      return BigDecimal.valueOf(result).floatValue();
  
    }
docs: method to calculate the extinction coefficient for peptide
  
  @param monomers all monomers of the peptide
  @return extinction coefficient
  @throws IOException
  @throws HELM2HandledException if HELM2 features were there