public static void main(String[] args) {

		readData();

		calculateAverageRatings();

		// Calculate mahalanobis distance for each user
		try {
			b = new BufferedReader(new FileReader(fileDirectory + dataFile));
			File base = new File(outputDirectory + fileName);
			if (!base.exists())
				base.createNewFile();
			FileWriter bw = new FileWriter(base.getAbsoluteFile());
			BufferedWriter baseWriter = new BufferedWriter(bw);

			String line;
			while ((line = b.readLine()) != null) {
				String[] s = line.split(":");
				if (first) {
					savedUser = Integer.valueOf(s[0]);
					first = false;
					double userMaha = calculateMahalanobi(savedUser);
					System.out.println(savedUser + "\t" + userMaha);
					baseWriter.write(savedUser + "\t" + userMaha + "\n");
				} else {
					if (Integer.valueOf(s[0]) != savedUser) {
						savedUser = Integer.valueOf(s[0]);
						double userMaha = calculateMahalanobi(savedUser);
						System.out.println(savedUser + "\t" + userMaha);
						baseWriter.write(savedUser + "\t" + userMaha + "\n");
					}
				}
			}
			System.out.println("Average common users: " + (userStatEnum / userStatDenom));
			baseWriter.close();

		} catch (FileNotFoundException e) {
			System.err.println("Couldn't read the parameter file. Check the file name: " + dataFile);
			e.printStackTrace();
		} catch (IOException ioe) {
			ioe.printStackTrace();
		}
	}