code: protected double computeAverageCharWidth(
              FontMetrics metrics,
              String testString) {
          int width = metrics.stringWidth(testString);
          double average = (double) width / testString.length();
          //System.out.println("Average width of '" + testString + "'=" + average);
          return average;
      }
docs: Computes and returns the average character width of the specified test string using the given
  FontMetrics. The test string shall represent an "average" text.
  
  @param metrics used to compute the test string's width
  @param testString the string that shall represent an "average" text
  @return the test string's average character width.