2D char 配列から文字を出力しようとしていますが、各文字ではなく文字列を取得し続けています。たとえば、コマンドラインの引数は
「-abcdefghij を暗号化」
String command = args[0];
String Text = args[1]; //letters to be
char letters [] = Text.toCharArray();
int m = Text.length(); //number of letters to be decrypted/encrypted
String command = args[0];
String Text = args[1]; //leters to be
char letters [] = Text.toCharArray();
int m = Text.length(); //number of letters to be decrypted/encrypted
if (command.equals("-encrypt")) {
//if statement was here before for perfect square numbers
else if ( m / (int) Math.sqrt(m) != Math.sqrt(m) ) { //non perfect square digits
int RootM = (int) Math.pow((Math.sqrt(m))+1,2); //overall size of 2d array (depth*width)
int RootN1 = (int) Math.sqrt(RootM); //length of rows & columns
char [][] box = new char [RootN1][RootN1]; //define dimensions of 2d array
for (int i=0; i<RootN1; i++) {
for (int j=0; j<RootN1; j++) {
box[i][j]=letters[2*i+j];
}
}
for (int i=0; i<RootN1; i++) {
for (int j=0; j<RootN1; j++) {
System.out.print(box[j][i]);