return 0;
try { if(d.endsWith("in") || d.endsWith("in")) { return (int)((Float.valueOf(d.substring(0, d.length()-2)).floatValue())*72000.0f); } else if(d.endsWith("cm") || d.endsWith("CM")) { return (int)((Float.valueOf(d.substring(0, d.length()-2)).floatValue())*72000.0f/2.54f); } else if(d.endsWith("mm") || d.endsWith("MM")) { return (int)((Float.valueOf(d.substring(0, d.length()-2)).floatValue())*7200.0f/2.54f); } else if(d.endsWith("px") || d.endsWith("PX")) { return (int)((Float.valueOf(d.substring(0, d.length()-2)).floatValue())/96.0f*72000.0f); } else { return (int)((Float.valueOf(d).floatValue( ))); } } catch(NumberFormatException ex) { ex.printStackTrace(); return 0; }
    public static int getDimensionValue(CSSValue value)    {    	if(value!=null && (value instanceof FloatValue))    	{    		FloatValue fv = (FloatValue)value;    		float v = fv.getFloatValue();    		switch(fv.getPrimitiveType())    		{    		case CSSPrimitiveValue.CSS_CM:    			return (int)(v*72000/2.54);    			    		case CSSPrimitiveValue.CSS_IN:    			return (int)(v*72000);    			    		case CSSPrimitiveValue.CSS_MM:    			return (int)(v*7200/2.54);    			    		case CSSPrimitiveValue.CSS_PT:    			return (int)(v*1000);    		case CSSPrimitiveValue.CSS_NUMBER:    			return (int)v;    		}    	}    	return 0;    }