public static void main(String[] args) {

		// Create .base and .test file and fill them with data
		String line;
		try {
			File data = new File(fileDirectory + fileName + ".dat");

			if (!data.exists())
				data.createNewFile();

			FileWriter dw = new FileWriter(data.getAbsoluteFile());
			BufferedWriter dataWriter = new BufferedWriter(dw);

			BufferedReader b = new BufferedReader(new FileReader(fileDirectory + dataFile));

			while ((line = b.readLine()) != null) {
				String[] s = line.split(":");
				int mov = Integer.parseInt(s[2]);
				int rat = Integer.parseInt(s[4]);

				if (ratingsByMovie.containsKey(mov)) {
					ratingsByMovie.get(mov).add((double) rat);
				} else {
					ArrayList<Double> ratings = new ArrayList<Double>();
					ratings.add((double) rat);
					ratingsByMovie.put(mov, ratings);
				}
			}
			b.close();
			
			b = new BufferedReader(new FileReader(fileDirectory + dataFile));
			while ((line = b.readLine()) != null) {
				String[] s = line.split(":");
				if(ratingsByMovie.get(Integer.parseInt(s[2])).size() > minimumRatings){				
					dataWriter.write(line + "\n");
				}
			}
			
			dataWriter.close();
		} catch (NumberFormatException nfe) {
			System.err.println("input data must be of type integer.");
			nfe.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		System.out.println("File " + fileName + ".dat has been created.");
	}