private static FlowSizeSpec mergeSizesGapsAndResConstrs(ResizeConstraint[] resConstr, boolean[] gapPush, int[][] minPrefMaxSizes, int[][] gapSizes)
{
int[][] sizes = new int[(minPrefMaxSizes.length << 1) + 1][];
ResizeConstraint[] resConstsInclGaps = new ResizeConstraint[sizes.length];
sizes[0] = gapSizes[0];
for (int i = 0, crIx = 1; i < minPrefMaxSizes.length; i++, crIx += 2) {
resConstsInclGaps[crIx] = resConstr[i];
sizes[crIx] = minPrefMaxSizes[i];
sizes[crIx + 1] = gapSizes[i + 1];
if (sizes[crIx - 1] != null)
resConstsInclGaps[crIx - 1] = gapPush[i < gapPush.length ? i : gapPush.length - 1] ? GAP_RC_CONST_PUSH : GAP_RC_CONST;
if (i == (minPrefMaxSizes.length - 1) && sizes[crIx + 1] != null)
resConstsInclGaps[crIx + 1] = gapPush[(i + 1) < gapPush.length ? (i + 1) : gapPush.length - 1] ? GAP_RC_CONST_PUSH : GAP_RC_CONST;
}
for (int i = 0; i < sizes.length; i++) {
if (sizes[i] == null)
sizes[i] = new int[3];
}
return new FlowSizeSpec(sizes, resConstsInclGaps);
}