public static ArrayList<String> chooseWords(int length) throws FileNotFoundException {
        ArrayList<String> words = new ArrayList<String>();
        Scanner sc = new Scanner(new File("words.txt"));
        while (sc.hasNextLine()) {
            String word = sc.nextLine();
            if (word.length() == length)
                words.add(word);
        }    
        return words;
    }