Java PrintWriter Write saveMatrixAsADM(AtomicReferenceArray matrix, String path)

Here you can find the source of saveMatrixAsADM(AtomicReferenceArray matrix, String path)

Description

save Matrix As ADM

License

Open Source License

Declaration

public static void saveMatrixAsADM(AtomicReferenceArray<AtomicIntegerArray> matrix, String path) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.FileNotFoundException;
import java.io.PrintWriter;

import java.util.concurrent.atomic.AtomicIntegerArray;
import java.util.concurrent.atomic.AtomicReferenceArray;

public class Main {
    public static void saveMatrixAsADM(AtomicReferenceArray<AtomicIntegerArray> matrix, String path) {
        PrintWriter pw;//from   w w  w  . j a  va  2s .  c o m

        try {
            pw = new PrintWriter(path);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            return;
        }

        for (int i = 0; i < matrix.length(); i++) {
            for (int j = 0; j < matrix.length(); j++) {
                pw.print(matrix.get(i).get(j) + " ");
            }
            pw.println();
        }

        pw.close();
    }
}

Related

  1. saveFile(String path, String text)
  2. saveHeatmapTableCsv(PrintWriter wr, double[][] coefficients, String[] labelNames)
  3. saveLastExpInfo(String fileName, int[] info)
  4. saveLine(File file, String line)
  5. saveList(List list, OutputStream outs)
  6. saveMineField(File fileName, String mineField)
  7. saveProbabilityData(String file, double[] probabilities, double start, double dt)
  8. saveProcessedDataFile(double[][] data, String file)
  9. saveSet(Set set, File setFile, String encoding)