【发布时间】:2015-01-23 17:59:00
【问题描述】:
我正在尝试交换矩阵的列,但我从 bouds 异常中得到了一个数组索引。矩阵就是这张图的转换:http://i.imgur.com/NcYPgRO.jpg
public static void especular(int [][] img){
for (int f=0; f<img.length;f++)
for (int c=0; c < img[f].length/2;c++){
int aux = img[f][c];
img[f][c] = img[f][img.length-1-c];
img[f][img.length-1-c] =aux;
}
}
【问题讨论】:
-
数组是方阵吗?
标签: java for-loop matrix indexoutofboundsexception