Q:

Java - Continuously check if input is a double

So, I've been a little stuck on this method I'm working on.  Basically, I need the method to take in input, check if it's actually a number, then see if it's between the max and min.
The problem I am currently having is when I ask the user to enter a new number, since their input was before 0 or greater than 1,000,000.  When the user enters anything other than a number it crashes.  Any ideas?
If you decide to show me how to fix it with a Try/Catch statement; would you tell me exactly how it works? I'm not 100% sure how those work yet!
The code has been edited with the latest version
public static double inRange( Scanner scan, int min, int max ) {
    double Amount = 0.0;
    boolean isValid = false;

    while( isValid == false ) {
        if( scan.hasNextDouble() ) {
            Amount = scan.nextDouble();
            if( Amount > max ) {
                System.out.print( "Error: You cannot enter a number greater than $1,000,000. Try again: " );
            }
            else if( Amount < min ) {
                System.out.print( "Error: You cannot enter a negative number. Try again: " );
            }
            else {
                isValid = true;
                break;
            }
        }
        else {
            System.out.print( "Error: You must enter a number! Try again: " );
            scan.next();
        }
    }
    return Amount;
}

A:

I think the bug is in these lines
if( scan.hasNextDouble() ) {
    ...
} else {
    System.out.print( "Error: You must enter a number! Try again: " );
    Amount = scan.nextDouble();  // problem is here, remove it!
}

If the scan has no next double, how can it get the next double value?
Besides, I think this line
Amount = scan.nextDouble();

should change to this
scan.next();

These are my codes, and they work fine.
Scanner scan = new Scanner(System.in);
int min = 0;
int max = 1000000;
double Amount = 0.0;
boolean isValid = false;

while (isValid == false) {
    if (scan.hasNextDouble()) {
        Amount = scan.nextDouble();
        if (Amount > max) {
            System.out.print("Error: You cannot enter a number greater than $1,000,000. Try again: ");
        }
        else if (Amount < min) {
            System.out.print("Error: You cannot enter a negative number. Try again: ");
        }
        else {
            isValid = true;
                }
        }
    else {
        System.out.print("Error: You must enter a number! Try again: ");
        scan.next();
    }
}

