title: How to show all factors of a number?(Edited)
body: <pre><code>    I need help on fixing my FactorX method. It needs to be like this&gt;&gt;.. The factors of x. (For example, if x is 120 then the factors would be 2, 2, 2, 3, 5). 
  
  
  
              ppublic static String factorX(long x){
              String factor="";
              long number = x;
              long i = 2;  
              while (i &lt; number) {  
                      if (number % i == 0) {
                      factor += i+", "+i+", "; 
                      number /= i;
  
                  } else {
                      i++;
                  }
              }
  
              return factor; 
  </code></pre>
  
  <p>I need my method to show all factors, now it is showing only one. I was told about List, but I cannot make to work.</p>