Q:

Parameterized Constructor for Polygon

I am creating a brick breaker game for school using ArrayLists, abstraction, and polymorphism. I have created an abstract class DrawableBrick that includes a draw method. I have already successfully created the other subclasses that fill my ArrayList and the game works beautifully, but I need to create a new subclass called ShavedBrick that is a polygon that can be easily added to my ArrayList.
I am a little stuck as to how to create the parameterized constructor for this class and to set the class data to the arguments passed in by the user. Here is what I have so far. It needs to be an octagon.
import java.awt.*;
import java.util.*;

public class ShavedBrick extends DrawableBrick {

    //data
    private int [] xArray = new int [8];
    private int [] yArray = new int [8];
    private int numberOfSides;
    //private Color color;

    //constructor
        public ShavedBrick(int[] x {}, int [] y {}, int numberOfPoints)
        {
            Random ranGen = new Random();
            xArray[0] = x;
            yArray[0] = y;
            this.numberOfSides = numberOfPoints; 
            //this.width = width;
            //this.height = height;
            this.color = new Color(0,(ranGen.nextInt(156)+100),0);

        }

    //draw - tells the ShavedBrick to draw itself, using the Graphics object received
        public void draw(Graphics g)
        {
            Color prevColor = g.getColor(); //save previous color associated with g
            g.setColor(this.color);
            g.fillPolygon(xArray, yArray, numberOfSides);
            g.setColor(prevColor);                  //restore previous color
         }

Here is an example of creating the object in the ArrayList
//some constants created in the main data
private final int WALLWIDTH = 5;    //Walls' width
private final int BRICKSTARTX = WALLWIDTH;
private final int BRICKSTARTY = 100 + WALLWIDTH;
private final int BRICKWIDTH = 150;
private final int BRICKHEIGHT = 75;

//Fill the ArrayList with random DrawableBricks

    for (int i = 0; i<10; i++){
        Random random = new Random();
        int randomBrick = random.nextInt(3);
        if (randomBrick == 0){
            myBricks.add(i, new RedBrick((BRICKSTARTX + i*BRICKWIDTH),(BRICKSTARTY + BRICKHEIGHT),BRICKWIDTH,BRICKHEIGHT));
            myBricks.add(i, new RedBrick((BRICKSTARTX + i*BRICKWIDTH),((BRICKSTARTY+75) + BRICKHEIGHT),BRICKWIDTH,BRICKHEIGHT));
        }
        else if (randomBrick == 1) {
            myBricks.add(i, new BlueBrick((BRICKSTARTX + i*BRICKWIDTH),(BRICKSTARTY + BRICKHEIGHT),BRICKWIDTH, BRICKHEIGHT));
            myBricks.add(i, new BlueBrick((BRICKSTARTX + i*BRICKWIDTH),((BRICKSTARTY+75) + BRICKHEIGHT),BRICKWIDTH,BRICKHEIGHT));
        }
        //else if (randomBrick == 3){
            //myBricks.add(new ShavedBrick(0,0,2,6));
        //}
        else if (randomBrick == 2){
            for (int i = 0; i<8; i++){
                xValues[] array = new xArray[8];
                myBricks.add(new ShavedBrick(int [i] x {BRICKSTARTX,});
            }

        }
    }

A:

i would suggest something like this...  
public ShavedBrick(int[] x, int[] y, int numberOfPoints)
        {
            Random ranGen = new Random();
            for(int i = 0; i < 8; i ++) {
                 xArray[i] = x[i];
                 yArray[i] = y[i];
            }
            this.numberOfSides = numberOfPoints;
            this.color = new Color(0,(ranGen.nextInt(156)+100),0);

        }

Basically, remove the braces ({ }) from the constructor signature. And add each of the 8 elements in the input arrays to the private arrays of the class using a for loop. You could point the private arrays of the class directly to the input arrays, but i would personally avoid that and simply copy the values to a newly created pair of arrays. 
You could also use the Array.copyOf(int[], int) http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html#copyOf(int[], int) as well.
In your client code just run a loop to compute your co-ordinates and then pass those co-ordinates along to the constructor like this ...
int[] xArray = new int[8];
int[] yArray = new int[8];
for (int i = 0; i < 8; i ++) {
   xArray[i] = //some value for the x co-ordinate of the ith point
   yArray[i] = //some value for the y co-ordinate of the ith point
}
ShavedBrick b = new ShavedBrick(xArray, yArray, 8);
myBricks.add(b); //finally add the new shaved brick

