Break a loop if q-key is pressed

// break a loop if 'q'-key is pressed
static Scanner scan = new Scanner(System.in);
public static boolean getUserInputExitKey() {
    System.out.println("Please enter key to continue or the q-key to exit.");
    String input = scan.nextLine();
    if (input == null || input.contentEquals("")) return false;
    if (input.contentEquals("q")) return true;
    else return false;
}

//////////////////////////////////////////////////////////////////////////////////////////////

do {

// do whatever..

} while(!getUserInputExitKey());