Java string input not working in If statement

This code over here is suppose to convert hexadecimal to binary. But so far I'm struggling with this one bug. Apparently whenever I run the code it skips the string input inside the if statement.

public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int type;
    boolean Valid = true;

    do{
        System.out.println("Convert a (1)HEX digit or (2)BI digit?: ");
        type = scan.nextInt();

        if(type == 1){
            System.out.println("Enter HEX digit: ");
            String hex = scan.nextLine();

            System.out.println("Your input is: " +hex);
        }else if(type == 2){
            System.out.println("Enter BI digit: ");
            String bin = scan.nextLine();

        }else{
            System.out.println("Not a proper input");

        }
    }while(Valid);
}

Instead of allowing me to type into the string input, instead it goes just repeats the loop like this:

Convert a (1)HEX digit or (2)BI digit?: //assume its 1

Enter HEX digit:

Convert a (1)HEX digit or (2)BI digit?: