public static void WriteResult(ArrayList<QueryPair> QuerySet,String OutputPath) throws IOException{
		//write all predict results to output file
		
		File WriteFile = new File(OutputPath);
		FileOutputStream IOStream = new FileOutputStream(WriteFile, true);
		OutputStreamWriter write = new OutputStreamWriter(IOStream);
		BufferedWriter writer = new BufferedWriter(write);
		int CurrentMovie = 0; 

		for (int i = 0; i < QuerySet.size(); i++){
			String str = "";
			if(QuerySet.get(i).getMovie() != CurrentMovie){
				str += QuerySet.get(i).getMovie();
				str += ":\n";
				CurrentMovie = QuerySet.get(i).getMovie();
			}
			
			str += QuerySet.get(i).getRating() + "\n";
			
			writer.write(str);
			writer.flush();
			write.flush();
		}

		writer.close();
		write.close();
		IOStream.close();
	}