code: public static void appendKMLCoordinates(Coordinate[] coords, StringBuilder sb) {
          sb.append("<coordinates>");
          for (int i = 0; i < coords.length; i++) {
              Coordinate coord = coords[i];
              sb.append(coord.x).append(",").append(coord.y);
              if (!Double.isNaN(coord.z)) {
                  sb.append(",").append(coord.z);
              }
              if (i < coords.length - 1) {
                  sb.append(" ");
              }
          }
          sb.append("</coordinates>");
      }
docs: Build a string represention to kml coordinates
  
  Syntax :
  
  <coordinates>...</coordinates> <!-- lon,lat[,alt] tuples -->
  
  @param coords