static void linXing() {
for (int i = 1; i <= 3; i++) {
for (int z = 1; z <= 3 - i; z++) {
System.out.print(" ");
}
for (int j = 1; j <= i * 2 - 1; j++) {
System.out.print("*");
}
System.out.println();
}
for (int a = 2; a >= 1; a--) {
for (int b = 1; b <= 3 - a; b++) {
System.out.print(" ");
}
for (int c = 1; c <= a * 2 - 1; c++) {
System.out.print("*");
}
System.out.println();
}
}
static void zhengFangXin() {
for (int i = 1; i <= 4; i++) {
for (int j = 1; j <= 4; j++) {
System.out.print("*" + " ");
}
System.out.println();
}
}
static void zhengSJX() {
for (int i = 1; i <= 4; i++) {
for (int j = 1; j <= i; j++) {
System.out.print("*" + " ");
}
System.out.println();
}
}
static void daoZhengSJX() {
for (int i = 4; i >= 1; i--) {
for (int j = 1; j <= i; j++) {
System.out.print("*" + " ");
}
System.out.println();
}
}
static void dengYaoSJX() {
for (int i = 1; i <= 4; i++) {
for (int z = 0; z <= 4 - i; z++) {
System.out.print(" ");
}
for (int j = 1; j <= i * 2 - 1; j++) {
System.out.print("*");
}
System.out.println();
}
}
static void daoDengYaoSJX() {
for (int i = 4; i >= 1; i--) {
for (int z = 0; z <= 4 - i; z++) {
System.out.print(" ");
}
for (int j = 1; j <= i * 2 - 1; j++) {
System.out.print("*");
}
System.out.println();
}
}
原文:http://www.cnblogs.com/zhu5201314/p/6291236.html