code: public static <E, C extends Counter<E>> double saferL2Norm(C c) {
      double maxVal = 0.0;
      for (E key : c.keySet()) {
        double value = Math.abs(c.getCount(key));
        if (value > maxVal)
          maxVal = value;
      }
      double sqrSum = 0.0;
      for (E key : c.keySet()) {
        double count = c.getCount(key);
        sqrSum += Math.pow(count / maxVal, 2);
      }
      return maxVal * Math.sqrt(sqrSum);
    }
docs: For counters with large # of entries, this scales down each entry in the
  sum, to prevent an extremely large sum from building up and overwhelming
  the max double. This may also help reduce error by preventing loss of SD's
  with extremely large values.
  
  @param <E>
  @param <C>