Bond[] addToBonds(Bond newBond, Bond[] oldBonds) {
		Bond[] newBonds;
		if (oldBonds == null) {
			if (numCached[1] > 0)
				newBonds = freeBonds[1][--numCached[1]];
			else newBonds = new Bond[1];
			newBonds[0] = newBond;
		}
		else {
			int oldLength = oldBonds.length;
			int newLength = oldLength + 1;
			if (newLength < MAX_BONDS_LENGTH_TO_CACHE && numCached[newLength] > 0)
				newBonds = freeBonds[newLength][--numCached[newLength]];
			else newBonds = new Bond[newLength];
			newBonds[oldLength] = newBond;
			for (int i = oldLength; --i >= 0;)
				newBonds[i] = oldBonds[i];
			if (oldLength < MAX_BONDS_LENGTH_TO_CACHE && numCached[oldLength] < MAX_NUM_TO_CACHE)
				freeBonds[oldLength][numCached[oldLength]++] = oldBonds;
		}
		return newBonds;
	}