private int getCommentsNum(File file) {

        if (!file.exists()) {
            return 0;
        }

        try {
            int comments = 0;
            String currentLine;

            BufferedReader reader = new BufferedReader(new FileReader(file));

            while ((currentLine = reader.readLine()) != null) {

                if (currentLine.startsWith("#")) {
                    comments++;
                }

            }

            reader.close();
            return comments;

        } catch (IOException e) {
            e.printStackTrace();
            return 0;
        }

    }