Greetings...I am working on drawing a d<>amond using my for loops. I have the top portion of my diamond working correctly but the bottom doesn't want to follow orders. The bottom triangle spaces do not match right. I was wondering if someone could take a look at where the error is coming from in the bottom triangle. I know there are more ways to do this and would also appreciate if you have other suggestions on to shorten and make this code look more elegant. Thanks!!
This is being called from the main()...Code:public class Diamond
{
static void diamondOfAsterisks(int len)
{
for (int i = 1; i <= len; i++)
{
// print spaces for top
for (int j = 1; j <= len - i; j++)
{
System.out.print(" ");
}
// print asterisks
for (int j = 1; j <= 2 * i - 1; j++)
{
System.out.print("*");
}
System.out.println();
}
// for each line of the bottom
for (int i = len - 1; i >= 1; i--)
{
// print spaces for bottom
for (int j = len - 1; j <= len - i + 1; j++)
{
System.out.print(" ");
}
// print asterisks
for (int j = 1; j <= 2 * i - 1; j++)
{
System.out.print("*");
}
System.out.println();
}
}

