title: ArrayList to Array
body: <p>How do I convert this ArrayList's value into an array? So it can look like,</p>
  
  <pre><code>String[] textfile = ... ;
  </code></pre>
  
  <p>The values are Strings (words in the text file), and there are more than a 1000 words. In this case I cannot do the, words.add("") 1000 times. How can I then put this list into an array?</p>
  
  <pre><code>    public static void main(String[]args) throws IOException
      {
          Scanner scan = new Scanner(System.in);
          String stringSearch = scan.nextLine();
  
          List&lt;String&gt; words = new ArrayList&lt;String&gt;(); //convert to array
          BufferedReader reader = new BufferedReader(new FileReader("File1.txt"));
  
          String line;
          while ((line = reader.readLine()) != null) {                
              words.add(line);
          }
  </code></pre>