Found the answer from a BA thread asking the same question. I've tested this, and it works.
The length of each handle (hlength1 and hlength2 respectively) is based on the “ Ease In/Out ” properties, the length of the bone, and a magic-number factor (“0.5f * sqrt(2) * kappa”, where kappa = the handle length – apparently this formula allows “for near-perfect ...
As commented, might pay to upload file with armature if more detail like bone roll is required.
Similarly to Straighten all bone chains in an armature a quick little script (in this case) to move parent tail to child head, connect and remove last bone.
In edit mode, grab the parent bones of chains you wish to "flatten and connect"