package shape;
public class Diamond {
public static void main(String[] args) {
int a[][] = new int[5][5];
int k = 0;
int row = 0;
int center = 5/2 + 1;
int begin = 0;
int end = 0;
for (row = 0; row < 5; row++) {
if (row < center) {
System.out.println("up");
begin = 2 - row;
end = row + 3;
}else{
System.out.println("down");
begin = row - 2;
end = 7 - row;
}
for (int j = begin; j < end; j++) {
k = k + 1;
a[row][j] = k;
}
}
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
System.out.print(a[i][j]+" ");
}
System.out.println();
}
}
}