title: Trying to return an array with stored elements (java)
body: <p>I am trying to store a set of numbers into an array with a for loop condition followed by if condition, and this method should return the array with stored elements respecting the conditional statement. I have been stuck in this problem for a while, but nothing is coming to my mind.</p>
  
  <pre><code>public int [] method ( int a) {
      int [] newarray=new int[count];
  
      for (int i=1; i&lt;=a; i++)  {
          If (a%i==0) {
              for (int m=0; m&lt;count;m++) {        
                 newarray[m]=a/i;
                 break;
              }
          }
      }
      return newarray;
  }
  </code></pre>