## Need help converting from recursion to queues

Java Code:
```import javax.swing.*;
import java.awt.*;
import java.util.*;

public class Fractalland extends JPanel
{
int a;
int d;
private  int Depth = 10;
private final int WIDE = 600;
private final int LENGTH = 600;
private final double scaleSize = 200.0;
private double Alpha;
private double Sigma;
Random rand = new Random();

private void segmentDraw(double x1, double y1, double x2, double y2, Graphics g, int level)
{
if (level == 0)
{
g.drawLine((int) x1, (int) y1, (int) x2, (int) y2);
return;
}
double px,py,qx,qy,rx,ry;

int Sigma = rand.nextBoolean() ? 1 : -1;

qx = (x1 + x2)/2.0 + (y2 - y1)*Alpha*Sigma;
qy = (y1 + y2)/2.0 - (x2 - x1)*Alpha*Sigma;
segmentDraw(x1,y1,qx,qy,g,level-1);
segmentDraw(qx,qy,x2,y2,g,level-1);
return;
}
public void paintComponent(Graphics g)
{
double x0,y0,x1,y1,x2,y2;

x0 = WIDTH/2 + scaleSize;
y0 = LENGTH/2;
x1 = WIDTH/2 + scaleSize*Math.cos(2*3.1416/3.0);
y1 = LENGTH/2 + scaleSize*Math.sin(2*3.1416/3.0);
x2 = WIDTH/2 + scaleSize*Math.cos(4*3.1416/3.0);
y2 = LENGTH/2 + scaleSize*Math.sin(4*3.1416/3.0);

segmentDraw(x0,y0,x1,y1,g,Depth);
segmentDraw(x1,y1,x2,y2,g,Depth);
segmentDraw(x2,y2,x0,y0,g,Depth);
}

public Fractalland()
{
setPreferredSize(new Dimension(WIDE,LENGTH));
Scanner scan = new Scanner(System.in);
System.out.println("alpha size: ");
Alpha = scan.nextDouble();
System.out.println("Depth size: ");
Depth = scan.nextInt();
}

}```
Java Code:
```import javax.swing.JFrame;

public class Island1
{
public static void main (String[] arg)
{
JFrame frame = new JFrame ("Island Fractal");