I have a problem with matrix. I have a matrix in txt file. This matrix looks:
231 324 123
345 565 234
657 234 654
I want to replacement elements to form:
654 234 657
234 565 345
231 324 123
I have a algorithm with replacement elements: 3-1-i, where i is number of choosen element from array. I have a problem how I read file and save elements to array and how implement this loop. This is my try with reading txt file and saving elements to array:
List<String[]> rows = new ArrayList<String[]>();
while ((line = bfr.readLine()) != null) {
String[] row = line.split(" ");
rows.add(row);
}
System.out.println(rows.toString());
But I get [Ljava.lang.String;@525483cd as result.
Can anyone help me with this loop and reading this matrix?
Note : I used String s with newline characters
\n, works the same way if the string is gotten from a file.Output is
Edit To read the string from file