如果给定大小,你将如何使用Java递归打印钻石?
大小为5会产生:
***** *****
**** ****
*** ***
** **
* *
* *
** **
*** ***
**** ****
***** *****
我到目前为止的守则
public static void dia(int statSize, int size,int count) {
int statSizeLarge = (statSize*2)+1;
// Params:
// statSize == static size, never change this
// size == variable size, change this
// count == counter
if(size==0) {
System.out.println();
} else {
// is the counter smaller then the size
// if yes, increment and keep printing
if(count
System.out.print("*");
}
// is greater then size?
// if yes, move on, print
// a few more stars
if((count<=statSizeLarge)){