static int convertUnits(String units,int defaultSuffix){
  if (units == null) {
    return -1;
  }
  int factor=1;
  int i=0;
  boolean suffixFound=false;
  for (; i < CSSElement.CSS_LENGTH_SUFFIX.length; i++) {
    if (units.endsWith(CSSElement.CSS_LENGTH_SUFFIX[i])) {
      factor=CSS_LENGTH_FACTORS[i];
      units=units.substring(0,units.length() - 2);
      suffixFound=true;
      break;
    }
  }
  if (!suffixFound) {
    i=defaultSuffix;
    factor=CSS_LENGTH_FACTORS[i];
  }
  try {
    int result=(int)(Float.parseFloat(units) * factor);
    if ((i == LENGTH_SUFFIX_EM) || (i == LENGTH_SUFFIX_EX)) {
      result+=VAL_EX;
    }
    return result;
  }
 catch (  NumberFormatException nfe) {
    return -1;
  }
}

static int convertUnits ( String units , int defaultSuffix ) { if ( units == null ) { return - 1 ; } int factor = 1 ; int i = 0 ; boolean suffixFound = false ; for ( ; i < CSSElement . CSS_LENGTH_SUFFIX . length ; i ++ ) { if ( units . endsWith ( CSSElement . CSS_LENGTH_SUFFIX [ i ] ) ) { factor = CSS_LENGTH_FACTORS [ i ] ; units = units . substring ( 0 , units . length ( ) - 2 ) ; suffixFound = true ; break ; } } if ( ! suffixFound ) { i = defaultSuffix ; factor = CSS_LENGTH_FACTORS [ i ] ; } try { int result = ( int ) ( Float . parseFloat ( units ) * factor ) ; if ( ( i == LENGTH_SUFFIX_EM ) || ( i == LENGTH_SUFFIX_EX ) ) { result += VAL_EX ; } return result ; } catch ( NumberFormatException nfe ) { return - 1 ; } }
converts the given css length string to pixels
