CCSVGIO { static protected double parseUnitSize(String text) { int len = text.length() - 2; if (text.endsWith("pt")) { return Double.parseDouble(text.substring(0, len)) * 1.25f; } else if (text.endsWith("pc")) { return Double.parseDouble(text.substring(0, len)) * 15; } else if (text.endsWith("mm")) { return Double.parseDouble(text.substring(0, len)) * 3.543307f; } else if (text.endsWith("cm")) { return Double.parseDouble(text.substring(0, len)) * 35.43307f; } else if (text.endsWith("in")) { return Double.parseDouble(text.substring(0, len)) * 90; } else if (text.endsWith("px")) { return Double.parseDouble(text.substring(0, len)); } else if (text.endsWith("%")) { return Double.parseDouble(text.substring(0, text.length() - 1)); } else { return Double.parseDouble(text); } }  static CCSVGDocument newSVG(final Path theSVG);  }
@Test public void testParseUnitSize() { assertEquals(CCSVGIONew.parseUnitSize("1"), 1f, 0f); }