public Ellipse2D getEllipse() {
        if (x1 > this.getWidth() - length) {
            xReverseFlag = -(int) (Math.random() * 5) - 1;
        }
        if (y1 > this.getHeight() - length) {
            yReverseFlag = -(int) (Math.random() * 5) - 1;
        }
        if (x1 < 0) {
            xReverseFlag = (int) (Math.random() * 5) + 1;
        }
        if (y1 < 0) {
            yReverseFlag = (int) (Math.random() * 5) + 1;
        }

        x1 += xReverseFlag;
        y1 += yReverseFlag;

        return new Ellipse2D.Double(x1, y1, length, length);
    }