public SparsedMatrix getRatings() throws FileNotFoundException {
        List<RatingRecord> ratingRecords = new ArrayList<RatingRecord>();

        File fileToRead = new File(fileName);
        Scanner scanner = new Scanner(fileToRead);
        int maxId = 0;
        int maxUserId = 0;

        while (scanner.hasNextLine()) {
            RatingRecord record = new RatingRecord(scanner.nextLine());
            if (record.getMovieId() > maxId) {
                maxId = record.getMovieId();
            }
            if (record.getUserId() > maxUserId) {
                maxUserId = record.getUserId();
            }
            ratingRecords.add(record);
        }
        scanner.close();

        SparsedMatrix result = new SparsedMatrix(maxId, maxUserId);

        for (RatingRecord record : ratingRecords) {
            result.insertNewElement(record.getUserId(), record.getMovieId(), record.getRating());
        }

        return result;

    }