解题思路:
高中数学知识
public static void show(int length) {
for (int x = -length; x <= length; x++) {
for (int y = -length; y <= length; y++) {
if (((y - x) <= length && (y - x) >= -length && ((y + x) >= -length && (y + x) <= length))) {
System.out.print("*");
} else {
System.out.print(" ");
}
}
System.out.println();
}
}
public static void main(String[] args) {
show(10);
}