code: private String getSVGPathData(Path2D path) {
          StringBuilder b = new StringBuilder("d=\"");
          float[] coords = new float[6];
          boolean first = true;
          PathIterator iterator = path.getPathIterator(null);
          while (!iterator.isDone()) {
              int type = iterator.currentSegment(coords);
              if (!first) {
                  b.append(" ");
              }
              first = false;
              switch (type) {
              case (PathIterator.SEG_MOVETO):
                  b.append("M ").append(geomDP(coords[0])).append(" ")
                          .append(geomDP(coords[1]));
                  break;
              case (PathIterator.SEG_LINETO):
                  b.append("L ").append(geomDP(coords[0])).append(" ")
                          .append(geomDP(coords[1]));
                  break;
              case (PathIterator.SEG_QUADTO):
                  b.append("Q ").append(geomDP(coords[0]))
                          .append(" ").append(geomDP(coords[1]))
                          .append(" ").append(geomDP(coords[2]))
                          .append(" ").append(geomDP(coords[3]));
                  break;
              case (PathIterator.SEG_CUBICTO):
                  b.append("C ").append(geomDP(coords[0])).append(" ")
                          .append(geomDP(coords[1])).append(" ")
                          .append(geomDP(coords[2])).append(" ")
                          .append(geomDP(coords[3])).append(" ")
                          .append(geomDP(coords[4])).append(" ")
                          .append(geomDP(coords[5]));
                  break;
              case (PathIterator.SEG_CLOSE):
                  b.append("Z ");
                  break;
              default:
                  break;
              }
              iterator.next();
          }  
          return b.append("\"").toString();
      }
docs: Creates an SVG path string for the supplied Java2D path.
  
  @param path  the path ({@code null} not permitted).
  
  @return An SVG path string.