public class Matrix {
private String[][] matrix;
private int row;
private int column;
public Matrix(String[][] matrix) {
// 行列本体
this.matrix = matrix;
// 行数取得
this.row = this.matrix.length;
if (row == 0) {
this.column = 0;
}
else {
this.column = this.matrix[0].length;
}
}
public String[][] transport (){
String[][] transportedArray = new String[column][row];
for (int i = 0; i < column; ++i) {
for (int j = 0; j < row; ++j) {
transportedArray[i][j] = matrix[j][i];
}
}
return transportedArray;
}
}
だんだんメソッドとかフィールドが増えていく予感。

0 コメント:
コメントを投稿