public static void writeMatrixToFile(Matrix m, String filename) {
try(FileWriter writer = new FileWriter(filename, false)){
StringBuilder sbForWrite = new StringBuilder();
for (int i = 0; i < m.getRowCount(); i++) {
for (int j = 0; j < m.getColCount(); j++) {
sbForWrite.append(m.get(i, j).toString());
sbForWrite.append(" ");
}