Java - Factor Generator program nextfactor method
<p>I've been trying to modify the nextfactor method for a while now to get the desired result. Basically, I'm supposed to  exclude all even numbers, except for 2 but am still unable to do it. The code for the class is below. Any help is appreciated. Regards</p>

<pre><code>public class FactorGenerator
{
   private int number;

   public FactorGenerator(int num)
{
    // initialise instance variables
    number = num;
    if (number &lt;= 2) {
        System.out.println("Wrong argument");
    }
}

   public boolean hasMoreFactors()
{
    if (number &gt;= 2) {
        return true;
    } else {
        return false;
    }
    // return (number &gt;= 2);
}

   public boolean isDivisible(int otherNumber)
{
    if (number % otherNumber == 0) {
        return true; 
    } else {
        return false;
    }
}

/**
 * Determine next factor.
 * pre-condition: call only if hasMoreFactors 
 * returns true
 * 
 * @return a factor of the object's number
 */
public int nextFactor()
{
    int triedFactor = 2;

 if(number % nextFactor == 0)

    while (! isDivisible(triedFactor)) {
        triedFactor = triedFactor+1;
    }
    number = number / triedFactor;
    return triedFactor;
}
        }
</code></pre>
