code: public static int getNumBondsInGroup(List<Atom> atomsInGroup) {
  		int bondCounter = 0;
  		for(Atom atom : atomsInGroup) {
  			if(atom.getBonds()==null){
  				continue;
  			}
  			for(Bond bond : atom.getBonds()) {
  				// Now set the bonding information.
  				Atom other = bond.getOther(atom);
  				// If both atoms are in the group
  				if (atomsInGroup.indexOf(other)!=-1){
  					Integer firstBondIndex = atomsInGroup.indexOf(atom);
  					Integer secondBondIndex = atomsInGroup.indexOf(other);
  					// Don't add the same bond twice
  					if (firstBondIndex<secondBondIndex){
  						bondCounter++;
  					}
  				}
  			}
  		}
  		return bondCounter;
  	}
docs: Find the number of bonds in a group
  @param atomsInGroup the list of atoms in the group
  @return the number of atoms in the group