code: public static final double[] toArray(Point... points)
      {
          double[] res = new double[2*points.length];
          int idx = 0;
          for (Point pp : points)
          {
              res[idx++] = pp.getX();
              res[idx++] = pp.getY();
          }
          return res;
      }
docs: Creates an array for points p1, p2,...
  @param points
  @return An array of [p1.x, p1.y, p2.x, p2.y, ...]