标题: 使用二维数组实现计算排序,不知道对不对,求指点 [打印本页] 作者: vincentgood 时间: 2014-4-21 11:53 标题: 使用二维数组实现计算排序,不知道对不对,求指点 ackage sort_bysz.com;
public class _SortBySz {
public static void main(String[] args) {
int number = 0;
int k = 0;
int l = 0;
int a [][] = new int[4][4];
char [] _SortPre = {'4','2','8','1','9','7'};
for(int i = 0; i < _SortPre.length; i++){
number = 0;
number = 10 * number + _SortPre[i] - '0';
k = number / 3;
l = number % 3;
a[k][l] = number;
}
for(int i = 0; i< a.length; i++){
for(int j = 0; j < a.length; j++){
if(a[i][j] != 0){
System.out.print(a[i][j]);
}
else
continue;
}
}
}
}作者: 谢振宣 时间: 2014-4-21 14:55