stackoverflow error : check if number is even or odd without % or / operator
<p>// check for a number is even or odd without / or % operator.</p>

<pre><code>public class EvenOrOdd {

    public static int CheckEvenOrOdd(int num) {
        if (num &gt; 2) {
            int number = num - 2;
            num = CheckEvenOrOdd(number);
        }
        return num;
    }

    public static void main(String[] args) {
        int num = CheckEvenOrOdd(5322221);
        if (num == 1) {
            System.out.println("Odd number");
        } else {
            System.out.println("Even number");
        }
    }

}
</code></pre>

<p>I defined stack size to 200m as -xss200m but this program turn up with OutOfMemory error and StackOverflow error if number is greater then 5322221.</p>

<p>Advise how to solve this problem to find the number is even or odd.</p>
