Question: ```
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/css/bootstrap-select.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/js/bootstrap-select.min.js"></script>

<!-- (Optional) Latest compiled and minified JavaScript translation files -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/js/i18n/defaults-*.min.js"></script>

<select class="selectpicker">
  <option>Mustard</option>
  <option>Ketchup</option>
  <option>Barbecue</option>
</select>

```

```

    My code is above and it isnt displayed on my website. What is the reason?

```

Answer: 
Your while condition is incorrect, `while(input < 1 || input > 20)` it is checking if number is less than 1 and greater than 20,

This problem has two parts, 1. check if input is valid number , 2. check if number is in range

```
public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        boolean validInput = false;
        do
        {
            System.out.println("Enter valid number ");
            // get user input
            String input =  sc.nextLine();

            if(isDigit(input)) {
                int inputNumber = Integer.parseInt(input);
                //check if number is in the range of 1 to 20
                boolean isInRange = (inputNumber > 1) && (inputNumber < 20);
                validInput  = true;
                if(isInRange) {
                    System.out.println(input+" is valid Number and in the range of 1 to 20");
                }
                else {
                    System.out.println(input+" is valid Number But Not in the range of 1 to 20");
                }
            }
            else {
                System.out.println(input+" is invalid Number");
            }
        }
        while (!validInput ); // continues untill valid input is entered

    }

```

Here `isDigit` method uses regular expresssion `[0-9]` to check if character is in the range of 0 to 9, you can check more on regular expressions here <https://www.w3schools.com/java/java_regex.asp>

```

    //check if input is valid number
    public static boolean isDigit(String input) {

        if (input == null || input.length() < 0)
            return false;
        input = input.trim();
        if ("".equals(input))
            return false;
        if (input.startsWith("-")) {
            return input.substring(1).matches("[0-9]*");
        } else {
            return input.matches("[0-9]*");
        }
    }

```
I am using two static functions to

1. Find the inputted number is integer or not [isInteger] and
2. To force the user to input a number between 1 and 20.

As you are an beginner, I did not use regular expression while checking the user input is number.

```
Scanner scanner = new Scanner(System.in);

public static void main(String[] args) {
    System.out.println("Enter an integer number between 1 and 20");
    String userInput = scanner.nextLine();

    int requiredInput = validateAndGetNumber(userInput);

    /*
      Now, do whatever you want to do with this requiredInput
    */
}

public static int validateAndGetNumber(String input) {

    if (isInteger(input)) {
        int num = Integer.parseInt(input);

        if (num >= 1 && num <= 20) 
            return num;
        else {
            System.out.println("Number is not in range 1-20. Please try again.");
            input = scanner.nextLine();
            return validateAndGetNumber(input);
        }
    }

    System.out.println("Input is not an integer number. Please try again.");
    input = scanner.nextLine();
    return validateAndGetNumber(input);
}

public static boolean isInteger(String str) {
    if (str == null) {
        return false;
    }
    int length = str.length();
    if (length == 0) {
        return false;
    }
    int i = 0;
    if (str.charAt(0) == '-') {
       System.out.println("Negative value is invalid for this property.");
       return false;
    }

    for (; i < length; i++) {
        char c = str.charAt(i);

        if ((c < '0' || c > '9') && c != '-') {
            return false;
        }
    }
    return true;
} 

```