public static int inputAmountOfPoints(String message) { Scanner scanner = new Scanner(System.in); int points = 0; boolean numberValid = false; while (!numberValid) { System.out.println(message); if (scanner.hasNextInt()) { points = scanner.nextInt(); //Doesn't accept values less than 0, acts as inout validation if (points <= 0) { //helpful comment to guide the user System.out.println("This is too small. Please input a number larger than 0"); } else { //breaks the loop when condition is met numberValid = true; } } else { System.out.println("This is not a number"); scanner.next(); } } return points; }