public class Test {
public static void main(String[] args) {
//输出5行
for(int i=1;i<=5;i++){
//输出每行的空格数目
for(int j=0;j<5-i;j++){
System.out.print(" ");
}
//输出左边2 33 444 5555
for(int k=i;k>1;k--){
System.out.print(i);
}
//输出中间 11234
for(int l=0;l<1;l++){
if(i==1){
System.out.print(1);
}else{
System.out.print(i-1);
}
}
//输出右边
for(int m=1;m<i;m++){
System.out.print(i);
}
System.out.println();
}
}
}
*********************
for (int i = 1; i <= 5; i++) {
for (int j = 1; j <= 5 - i; j++) {
System.out.print(" ");
}
for (int k = 1; k <= 2 * i - 1; k++) {
if (k == i) {
System.out.print((i - 1) == 0 ? 1 : (i - 1));
} else {
System.out.print(i);
}
}
System.out.println();
}
}