Graphic Java

ASSIGNMENT:
Draw this recursive tree structure. See if you can figure out how to use the code sample from below (don't worry if you can't figure it out).

public void drawTree(Graphics g, int d, int x, int y, int l){ if(d>360) d-=360; if(d<0) d+=360; double endX=l*Math.cos(d*Math.PI/180)+x; double endY=l*Math.sin(d*Math.PI/180)+y; g.drawLine(x,y,(int)endX,(int)endY); if(l>1){ drawTree(g,d+45,(int)endX,(int)endY,l/2); drawTree(g,d-45,(int)endX,(int)endY,l/2); } }
Variables: