Graphic Java

ASSIGNMENT:
Use the method supplied below to create the graphic displayed in the sample applet.

public void drawCurl(Graphics g, int d, int x, int y, int len){ // d for direction // 0 for right, 1 for down, 2 for left, 3 for up int endy=0; int endx=0; switch(d){ case 0: endx=x+len; g.drawLine(x,y,endx,y); if(len>5)drawCurl(g, (d+1)%4, endx, y, len-5); break; case 1: endy=y+len; g.drawLine(x,y,x,endy); if(len>5)drawCurl(g, (d+1)%4, x, endy, len-5); break; case 2: endx=x-len; g.drawLine(x,y,endx,y); if(len>5)drawCurl(g, (d+1)%4, endx, y, len-5); break; case 3: endy=y-len; g.drawLine(x,y,x,endy); if(len>5)drawCurl(g,(d+1)%4,x,endy,len-5); break; } }