IdentityTemplateLibrary { static String encodeCoordinates(Point2d[] points) { DecimalFormat fmt = new DecimalFormat(".##", DecimalFormatSymbols.getInstance(Locale.ROOT)); StringBuilder sb = new StringBuilder(); sb.append("|("); for (Point2d point : points) { if (sb.length() > 2) sb.append(";"); sb.append(fmt.format(point.x)); sb.append(','); sb.append(fmt.format(point.y)); sb.append(','); } sb.append(")|"); return sb.toString(); } private  IdentityTemplateLibrary(); IdentityTemplateLibrary add(IdentityTemplateLibrary library);  }
@Test public void encodeCoordinates() throws Exception { Point2d[] points = new Point2d[]{new Point2d(12.5f, 5.5f), new Point2d(4f, 2f)}; String str = IdentityTemplateLibrary.encodeCoordinates(points); assertThat(str, is("|(12.5,5.5,;4.0,2.0,)|")); }