stavo provando a fare una cosa del genere prendo in input un BufferedReader per leggere un file in cui ho: nella prima riga il numero delle righe presenti nel file, e dopo una serie di numeri.Ad esempio
codice:
3
12 5 1 7 3 9 23 43 21 12 11 5 14
8 42 20 76 2 10 14 22 8
10 2 33 42 8 9 65 37 2 88 21
in output devo avere un file in cui ho 1 se i prodotti sn dispari 0 altrimenti.
non capisco dove sbaglio, credo il problema sia nella chiusura dello stream

codice:
	public static int [] array (BufferedReader a) throws IOException {
		
		int [] data = new int[a.read()];
			
			for(int i = 0; i<data.length; i++) {
				
				data[i] = a.read();
				
				
				
			}
		
		return data;
		
	}
	
	public static boolean controlla(int data[]) {
		
		for(int i = 0; i<data.length; i++) {
			
			for(int j = i+1; j<data.length-1; j++) {
				
				int c = data[i]*data[j];
				if(c%2!=0) return true;
			}
		}
		return false;
	}
	
	
	
	public static void main(String[] args) {
		
		
		try {
			
			BufferedReader reader = new BufferedReader(new FileReader("input.txt"));
			BufferedWriter out =    new BufferedWriter(new FileWriter("output.txt"));
		
			int b = reader.read();
					
			for(int x = 0; x <b; x++) {
				
				int [] data =array(reader);
				
					if(controlla(data)==true) {
						
						out.write(1);
						
						
					}
					
					else {
						
						out.write(0);
						
					}
					
			}
			
			out.close();
			
		}
		
		catch(IOException e) {
			e.printStackTrace();
		}

	}