Only accept positive integers using while loop or any other
<p>My program currently rejects any inputs other than an integer, but I'm trying to take it one step further and have it accept only positive integers. How would i accomplish this. I tried creating another boolean and calling it numisGreat and another do-while loop for this part, but I'm cant seem to get it. </p>

<pre><code>import java.util.Scanner;

public class TandE {

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);

        int firstN = 0;
        int secondN = 0;
        boolean isNumber = false;
        boolean numisGreat = false;

        System.out.print("Enter a positive integer: ");
        do {
            if (input.hasNextInt()) {
                firstN = input.nextInt();
                isNumber = true;
            } else {
                System.out.print("Please enter a positive integer: ");
                isNumber = false;
                input.next();
            }

        } while (!(isNumber));

        System.out.print("Enter another positive integer: ");
        do {
            if (input.hasNextInt()) {
                secondN = input.nextInt();
                isNumber = true;
            } else {
                System.out.print("Please enter a positive integer: ");
                isNumber = false;
                input.next();
            } 

        } while (!(isNumber));

        System.out.println("The GCD of " + firstN + " and " + secondN + " is " + gCd(firstN, secondN));

    }

    public static int gCd(int firstN, int secondN) {
        if (secondN == 0) {
            return firstN;
        } else
            return gCd(secondN, firstN % secondN);
    }

}
</code></pre>