static int convertUnitsOrPercentage(String units,int defaultSuffix){
  if (units == null) {
    return -1;
  }
  boolean percentage=false;
  if (units.charAt(units.length() - 1) == '%') {
    percentage=true;
    defaultSuffix=LENGTH_SUFFIX_PX;
    units=units.substring(0,units.length() - 1);
  }
  int val=convertUnits(units,defaultSuffix);
  if (percentage) {
    val+=VAL_PERCENTAGE;
  }
  return val;
}

static int convertUnitsOrPercentage ( String units , int defaultSuffix ) { if ( units == null ) { return - 1 ; } boolean percentage = false ; if ( units . charAt ( units . length ( ) - 1 ) == '%' ) { percentage = true ; defaultSuffix = LENGTH_SUFFIX_PX ; units = units . substring ( 0 , units . length ( ) - 1 ) ; } int val = convertUnits ( units , defaultSuffix ) ; if ( percentage ) { val += VAL_PERCENTAGE ; } return val ; }
converts the given css length / percentage string to pixels
