code: public void setWidths(float[] widths) throws BadElementException {
          if (widths.length != columns) {
              throw new BadElementException("Wrong number of columns.");
          }
          
          // The sum of all values is 100%
          float hundredPercent = 0;
          for (int i = 0; i < columns; i++) {
              hundredPercent += widths[i];
          }
          
          // The different percentages are calculated
          float width;
          this.widths[columns - 1] = 100;
          for (int i = 0; i < columns - 1; i++) {
              width = (100.0f * widths[i]) / hundredPercent;
              this.widths[i] = width;
              this.widths[columns - 1] -= width;
          }
      }
docs: Sets the widths of the different columns (percentages).
  <P>
  You can give up relative values of borderwidths.
  The sum of these values will be considered 100%.
  The values will be recalculated as percentages of this sum.
  <P>
  example:
  <BLOCKQUOTE><PRE>
  float[] widths = {2, 1, 1};
  <STRONG>table.setWidths(widths)</STRONG>
  </PRE></BLOCKQUOTE>
  The widths will be: a width of 50% for the first column,
  25% for the second and third column.
  
  @param       widths  an array with values
  @throws BadElementException