code: public int strDistance(char[] a, char[] b) throws SAXException {
      if (a.length == b.length) {
        int distance = 0;
        for (int i = 0; i < a.length; i++) {
          int tDist = Math.abs(Character.getNumericValue(a[i]) - Character.getNumericValue(b[i]));
          distance += tDist;
        }
        return distance;
      }
      else {
        throw new SAXException("Unable to compute SAX distance, string lengths are not equal");
      }
    }
docs: Compute the distance between the two strings, this function use the numbers associated with
  ASCII codes, i.e. distance between a and b would be 1.
  
  @param a The first string.
  @param b The second string.
  @return The pairwise distance.
  @throws SAXException if length are differ.