code: private int getClosestDataDiff(IsotopeContainer isoContainer, IsotopePattern pattern) {
          double diff = 100;
          int posi = -1;
          for (int i = 0; i < pattern.getNumberOfIsotopes(); i++) {
              double tempDiff = Math.abs((isoContainer.getMass()) - pattern.getIsotopes().get(i).getMass());
              if (tempDiff <= (tolerance_ppm / isoContainer.getMass()) && tempDiff < diff) {
                  diff = tempDiff;
                  posi = i;
              }
          }
  
          return posi;
      }
docs: Search and find the closest difference in an array in terms of mass and
  intensity. Always return the position in this List.
  
  @param diffValue  The difference to look for
  @param normMass   A List of normalized masses
  @return           The position in the List