Hello, I've some problems writing out my stored data from my array to a text file.
I've managed to get some kind of data in the file but I've problems understanding what it really is (is it correct?). The thing is, the file is about 4Mb and when I try to open it - it doesn't open because the computer is just trying to load it. So I then use the "cat gedit filename" command in the terminal (yes I use linux) and I see lots of squares with digits in each square being printed out, almost looks like bits because I see lots of zeros and ones. But also I'm very aware that my array contains lots of zeros and ones which makes it hard to see if it's even the contents of the array.
See the code below.

However, regarding the other code in the file is solving a problem from Project Euler, but I'm going to use the data for something else myself so I want to store it all in an array then save it to a separate file. Solving the problem is fine it works out well, but - my "write-to-file" (see method "write") doesn't work - or it does work but I'm not able to understand the contents of the file.

The file should contain lots of zeros and ones, some higher (highest value in the array is 71), and the array is a square matrix of size 2000x2000.
I've tried printing out the contents of the array separately to debug and see if it works so far - and it does.

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
 
 
public class Euler27_MATLAB {
 
	public static boolean isPrime(int n){
		if(n<2 || (n>2 && n%2==0)){
			return false;
		}else if(n==2){
			return true;
		}else{
			for(int i=3; i<=Math.sqrt(n); i=i+2){
				if(n%i==0){
					return false;
				}
			}
			return true;
		}		
	}
               //THIS IS WHERE I NEED HELP
 
	public static void write (String filename, int[][]x) throws IOException{
		  BufferedWriter outputWriter = null;
		  outputWriter = new BufferedWriter(new FileWriter(filename));
		  for (int i = 0; i < x.length; i++) {
		    for(int j=0; j<x.length; j++){ //array is square
		    	outputWriter.write((x[i][j]));
		    }
		    outputWriter.newLine();
		  }
		  outputWriter.flush();  
		  //outputWriter.close();  
		}
	public static void main(String[] args){
		int tmp=0; int A = 0; int B = 0; int limit = 1000;
		int nbr = 0;
		int [][]array = new int[limit*2+1][limit*2+1];
		long start = System.currentTimeMillis();
		for(int a=-limit; a<=limit; a++){ //2 if only odd nbrs
			for(int b=-limit; b<=limit; b++){	
				while(isPrime(nbr*nbr+a*nbr+b)){ //n^2+an+b
					nbr++;
				}
				array[a+limit][b+limit]=nbr;
 
				if(nbr>tmp){	//store the values for later out-print
					tmp = nbr; A=a; B=b;
				}
				nbr=0;
			}
		}
		long time = System.currentTimeMillis() - start;
		System.out.println("The product a*b is: " + A*B + "\nwith a=" + A +
				" and b=" + B + " with limit " + limit +".");
		System.out.println("Formula generated " + tmp + " primes.");
		System.out.println("Time: " + time + " ms.");
 
				//FOR THE ARRAY --------------------------------------------------------------
		try{
			write("/home/robin/workspace/ProjectEuler/src/pe27",array);	
		}catch(Exception e){
			System.out.println("Failure");
		}
	}
}

I've tried several codes I've found via Google but those attempts were unsuccessful.

//Robin