There are several things going on here, one of which is an unclear question. And, the two questions are unrelated.
Anybody that has been around for a while would know that "240 Rocket" was probably a typo, or judging by the first question, coming from somebody without extensive knowledge of the subject matter, which is not a sin, by the way.
In the first place, the poster asks about "optimum" barrel length, (my word, for the present) but it sounds like he intends to buy a factory rifle, in which case, there won't be too many choices, and probably none of the choices would be considered optimum, if the meaning is to squeeze as much velocity as practical from that cartridge. The reasonable answer would be to select the longest he can find, which might still be less than "optimum". Now; define optimum? Means different things to different people. Another twelve inches of barrel to gain 50fps? Subjective opinion. But, don't forget, he did say, "highest velocities". How do you really answer that one, from a personal perspective? You start getting into much slower powders than are normally used in a 223. Again, he wants to buy a factory rifle, not get into a technical quest for pure research.
However, we cannot fault those people that reply with whatever information they are able to offer. After all, it's free advice, and well intended.
On the other hand, I understand the frustration if the reply doesn't <u>write to the question</u>; something I learned in school, a long time ago. Some answers are truly worthless, but diplomacy goes a long way toward redirecting the conversation back to where it can provide usable content.
Short answer #1: 22" is blisfully adequate.
short answer #2: anything beyond 220 Swift capacity is overbore, IMHO; and not for the casual recreational shooter.
Good hunting. LB