public void write(File file) throws IOException {
        try (FileWriter writer = new FileWriter(file)) {
            writer.write(rows + " " + columns);
            for (int i = 0; i < rows; i++) {
                writer.write("\n" + get(i, 0) + " ");
                for (int j = 1; j < columns; j++) {
                    writer.write(get(i, j) + " ");
                }
            }
        }
    }