Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.awt.Polygon;

import java.awt.geom.PathIterator;
import java.util.ArrayList;

public class Main {
    private static ArrayList<Double> getCoords(Polygon p) {
        ArrayList<Double> vals = new ArrayList<Double>();

        for (PathIterator iter = p.getPathIterator(null); !iter.isDone();) {
            double[] coords = new double[2];
            iter.currentSegment(coords);
            vals.add(coords[0]);
            vals.add(coords[1]);
            iter.next();
        }
        return vals;
    }
}