Do you guys know a better way to write this?
bool a = Directory.Exists("C:\\Program Files\\Java\\jdk1.6.0_1");
bool b = Directory.Exists("C:\\Program Files\\Java\\jdk1.6.0_2");
bool c = Directory.Exists("C:\\Program Files\\Java\\jdk1.6.0_3");
bool d = Directory.Exists("C:\\Program Files\\Java\\jdk1.6.0_4");
bool ee = Directory.Exists("C:\\Program Files\\Java\\jdk1.6.0_5");
bool f = Directory.Exists("C:\\Program Files\\Java\\jdk1.6.0_6");
bool g = Directory.Exists("C:\\Program Files\\Java\\jdk1.6.0_7");
bool h = Directory.Exists("C:\\Program Files\\Java\\jdk1.6.0_8");
bool i = Directory.Exists("C:\\Program Files\\Java\\jdk1.6.0_9");
bool j = Directory.Exists("C:\\Program Files\\Java\\jdk1.6.0_10");
bool k = Directory.Exists("C:\\Program Files\\Java\\jdk1.6.0_11");
bool l = Directory.Exists("C:\\Program Files\\Java\\jdk1.6.0_12");
bool m = Directory.Exists("C:\\Program Files\\Java\\jdk1.6.0_13");
bool n = Directory.Exists("C:\\Program Files\\Java\\jdk1.6.0_14");
bool o = Directory.Exists("C:\\Program Files\\Java\\jdk1.6.0_15");
bool p = Directory.Exists("C:\\Program Files\\Java\\jdk1.6.0_16");
bool q = Directory.Exists("C:\\Program Files\\Java\\jdk1.6.0_17");
if (a)
{
label1.Text = "Jdk version: 1.6.0_1";
}
if (b)
{
label1.Text = "Jdk version: 1.6.0_2";
}
if (c)
{
label1.Text = "Jdk version: 1.6.0_3";
}
if (d)
{
label1.Text = "Jdk version: 1.6.0_4";
}
if (ee)
{
label1.Text = "Jdk version: 1.6.0_5";
}
if (f)
{
label1.Text = "Jdk version: 1.6.0_6";
}
if (g)
{
label1.Text = "Jdk version: 1.6.0_7";
}
if (h)
{
label1.Text = "Jdk version: 1.6.0_8";
}
if (i)
{
label1.Text = "Jdk version: 1.6.0_9";
}
if (j)
{
label1.Text = "Jdk version: 1.6.0_10";
}
if (k)
{
label1.Text = "Jdk version: 1.6.0_11";
}
if (l)
{
label1.Text = "Jdk version: 1.6.0_12";
}
if (m)
{
label1.Text = "Jdk version: 1.6.0_13";
}
if (n)
{
label1.Text = "Jdk version: 1.6.0_14";
}
if (o)
{
label1.Text = "Jdk version: 1.6.0_15";
}
if (p)
{
label1.Text = "Jdk version: 1.6.0_16";
}
if (q)
{
label1.Text = "Jdk version: 1.6.0_17";
}
I know it can be done better, but I don't know how.