public static void buildSystemFromFile(String filename, GaussSeidel system) {
	ArrayList<ArrayList<Integer>> rowIndexes = null;
	ArrayList<ArrayList<String>> colIndexes = null;
	ArrayList<Double> values = null;
	ArrayList<Double> diag = null;
	ArrayList<Double> b = null;
	int size = 0;
	
	BufferedReader buffReader = null;
	
	try {
	    buffReader = new BufferedReader(new FileReader(filename));
	    
	    size = Integer.parseInt(buffReader.readLine());
	    buffReader.readLine();
	    
	    b = new ArrayList<Double>(size);
	    buildB(b, buffReader, size);
	    
	    buffReader.readLine();
	    rowIndexes = new ArrayList<ArrayList<Integer>>(size);
	    colIndexes = new ArrayList<ArrayList<String>>(size);
	    values = new ArrayList<Double>();
	    diag = new ArrayList<Double>();
	    buildMatrix(rowIndexes, colIndexes, values, diag, buffReader, size);
	    
	    SparseMatrix matrixA = new DoubleSparseMatrix(rowIndexes, colIndexes, values, diag, size);
	    SparseMatrix matrixB = matrixA.BMatrix();
	    SparseMatrix matrixC = matrixA.CMatrix();
	    system.setB(b);
	    system.setMatrixA(matrixA);
	    system.setMatrixB(matrixB);
	    system.setMatrixC(matrixC);
	    
	} catch (FileNotFoundException e) {
	    Logger.getLogger(MatrixBuildUtils.class.getSimpleName()).warning("the file doesn't exist");
	    e.printStackTrace();
	} catch (NumberFormatException e) {
	    Logger.getLogger(MatrixBuildUtils.class.getSimpleName()).warning("cannot parse string to number");
	    e.printStackTrace();
	} catch (IOException e) {
	    Logger.getLogger(MatrixBuildUtils.class.getSimpleName()).warning("cannot read line");
	    e.printStackTrace();
	} finally {
	    if (buffReader != null) {
		try {
		    buffReader.close();
		} catch (IOException e) {
		    Logger.getLogger(MatrixBuildUtils.class.getSimpleName()).warning("cannot close buff reader");
		    e.printStackTrace();
		}
	    }
	}
	
    }