double length = 0; for (int i = 1; i < points.length; i++) { IntLine l = new IntLine(points[i - 1], points[i]); segments.add(l); length += l.getLength(); } this.length = (int) length;
this.length = (int) actualLength.getLength();
    public TrainPath (Point[] points) {	if (points.length < 2) {	    throw new IllegalArgumentException();	}	double length = 0;	for (int i = 1; i < points.length; i++) {	    IntLine l = new IntLine(points[i - 1], points[i]);	    segments.add(l);	    length += l.getLength();	}	this.length = (int) length;    }