code: public static double getBondLengthAverage(IAtomContainer container) {
          double bondLengthSum = 0;
          Iterator<IBond> bonds = container.bonds().iterator();
          int bondCounter = 0;
          while (bonds.hasNext()) {
              IBond bond = bonds.next();
              IAtom atom1 = bond.getBegin();
              IAtom atom2 = bond.getEnd();
              if (atom1.getPoint2d() != null && atom2.getPoint2d() != null) {
                  bondCounter++;
                  bondLengthSum += getLength2D(bond);
              }
          }
          return bondLengthSum / bondCounter;
      }
docs: An average of all 2D bond length values is produced. Bonds which have
  Atom's with no coordinates are disregarded.
  See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets
  
  @param  container  The AtomContainer for which the average bond length is to be
  calculated
  @return     the average bond length