If you are just started learning Java, on your own or in school. You will be asked to draw different kind of shapes using asterisks in command prompt or terminal for linux. They could be triangle, rectangle, square or whatever. This kind of exercise is very good to “train” you to understand the looping concepts, like nested loop within loop inside loop or whatever……
So, I think the most difficult shape and it would cover almost all the shapes possible made within the command prompt or terminal will be diamond shape.

This shape actually cover triangle, up-side down, could cover square, and rectangle.
And here’s how you do it.
for (i = 1; i <= size; i++){
for (k = size; k > i; k--)
System.out.print(" ");
for (j =1; j <= i; j++)
System.out.print("*" + " ");
System.out.println();
}
for (i = size; i > 0; i--){
for (k = size; k > i; k--)
System.out.print(" ");
for (j =1; j <= i; j++)
System.out.print("*" + " ");
System.out.println();
}
So, there are two BIG loops, the first one is to create the top part of diamond
which is triangle, and the second loop will draw the bottom part of diamond.
Good luck with your Java!
CK