private static void validateMass(ISpectrumPeak pSp, double pPeak, Set<Integer> goodMasses) {
    final double mass = pSp.getMassChargeRatio();
    final int imass = asInt(mass);
    if (!goodMasses.contains(imass)) {
      // try one off
      if (goodMasses.contains(imass - 1)) {
        goodMasses.remove(imass - 1);
        return;
      }
      if (goodMasses.contains(imass + 1)) {
        goodMasses.remove(imass + 1);
        return;
      }
    }

    if (!goodMasses.contains(imass)) System.out.println("Missing mass " + imass);

    goodMasses.remove(imass);
  }
 private static void validatePeak2(ISpectrumPeak pSp, double pPeak, double pPeak1) {
   Set<Integer> goodMasses = buildMassSet();
   final double chargeRatio = pSp.getMassChargeRatio();
   validateAsInts(chargeRatio, pPeak);
   double peak = pSp.getPeak();
   Assert.assertEquals(pPeak1, peak, ALLOWED_INTENSITY_ERROR);
 }