int n = 4; int[] xArray = new int[n]; //allocate memory int[] yArray = new int[n]; xArray[0] = 20; //first point yArray[0] = 20; xArray[1] = 20; //second point yArray[1] = 80; xArray[2] = 80; //third point yArray[2] = 80; xArray[3] = 80; //fourth point yArray[3] = 20; beginShape(POLYGON); for(int i = 0; i < n; i++) vertex(xArray[i],yArray[i]); //retrieve in an ordered fashion endShape(CLOSE);