W***i 发帖数: 9134 | 2 来自主题: JobHunting版 - 请教一道题 private int[][] A = {{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}};
public void printA()
{
int endX = A.length-1;
int endY = endX;
int startX = 0;
int startY = 0;
while(endX > 0 )
{
for(int i = startX; i <= endX; i++)
{
System.out.print(A[startX][i] + ",");
}
startY++;
for(int i = startY; i <= endY; i++)
{
System.out.print(A[i][endX] + ",");
}
endX--;
|
|