float maxAdjust = Math.abs(total - sumPref); factor = diff / maxAdjust; factor = Math.min(factor, 1.0F); factor = Math.max(factor, -1.0F); }   int totalOffs = 0; for (int i = 0; i < n; i++) { offsets[i] = totalOffs; if (diff != 0) { float adjust = factor * diffs[i]; spans[i] += Math.round(adjust); }  totalOffs = (int) Math.min((long) totalOffs + (long) spans[i], Integer.MAX_VALUE); }
  protected void layoutMajorAxis(int targetSpan, int axis, int[] offsets,                                 int[] spans)  {    updateChildRequirements(axis);    updateRequirements(axis);    // Calculate the spans and offsets using the SizeRequirements uility    // methods.    SizeRequirements.calculateTiledPositions(targetSpan, requirements[axis],                                             childReqs[axis],                                             offsets, spans);  }