code: public void rebond(IAtomContainer container) throws CDKException {
          container.removeAllBonds();
          maxCovalentRadius = 0.0;
          // construct a new binary space partition tree
          bspt = new Bspt(3);
          Iterator<IAtom> atoms = container.atoms().iterator();
          while (atoms.hasNext()) {
              IAtom atom = atoms.next();
              double myCovalentRadius = atom.getCovalentRadius();
              if (myCovalentRadius == 0.0) {
                  throw new CDKException("Atom(s) does not have covalentRadius defined.");
              }
              if (myCovalentRadius > maxCovalentRadius) maxCovalentRadius = myCovalentRadius;
              TupleAtom tupleAtom = new TupleAtom(atom);
              bspt.addTuple(tupleAtom);
          }
          // rebond all atoms
          atoms = container.atoms().iterator();
          while (atoms.hasNext()) {
              bondAtom(container, (IAtom) atoms.next());
          }
      }
docs: Rebonding using a Binary Space Partition Tree. Note, that any bonds
  defined will be deleted first. It assumes the unit of 3D space to
  be 1 Å.