Try This,
Though I have not tested it Should Probably work
try{
int choice ;
do {
System.out.println("Help on:");
System.out.println("\t1. if");
System.out.println("\t2. switch");
System.out.println("\t3. while");
System.out.println("\t4. do-while");
System.out.println("\t5. for\n");
System.out.println("Choose one: ");
//choice = (char) System.in.read();
BufferedReader input = new BufferedReader(new
InputStreamReader(System.in));
String str = input.readLine();
try{
choice = Integer.parseInt(str);
}catch(NumberFormatException e){
choice = 0 ;
}
} while (choice < 1 || choice > 5);
}catch(Exception e){
e.printStackTrace();
}