title: (Java) Method to find number divisible by a number and add to array to be print out
body: <p>I want to make a method to find a number divisible by a number and add those numbers to an array to be printed out later when I call the method.</p>
  
  <p>I made it to this point:</p>
  
  <pre><code>int [] divider(int n) {
      int [] result = new int[20];
      for (int i = 0; i &lt;= n; i++) {
         if (n%i == 0)
            result = result[i];
      }
      return result;
  }
  </code></pre>
  
  <p>I know it's wrong at many points, but I tried. This is the two thing I know I need to do, but I don't know how:</p>
  
  <ol>
  <li><p>I know that I have the calculate how many numbers that divisible by a number first to know how big of an array to create. The problem is I know how to find how many number there are, but I don't know how to use that number to create an array by itself in the method.</p></li>
  <li><p>After that I need to find what is those numbers in which it can divide by another number. This one I could do it, but I don't know how to add these result into an array to print out later.</p></li>
  </ol>
  
  <p>These are what I know up until now. Please help. Thank you.</p>