if (beg == null || end == null) throw new IllegalStateException("Bond " + bondIdx + " had one or more atoms."); int begIdx = findIdx(idxs, beg); int endIdx = findIdx(idxs, end); if (begIdx < 0 || endIdx < 0) throw new IllegalStateException("Bond " + bondIdx + " had atoms not present in the molecule.");