>>40 入力して、の所
public static void main(String[] args) throws IOException {
InputStreamReader in = new InputStreamReader(System.in);
BufferedReader b = new BufferedReader(in);
String str = null;
byte N = 0;

System.out.print("IN:");
str = b.readLine();
b.close();
in.close();
try {
N = Byte.parseByte(str);
} catch (NumberFormatException e) {
System.out.println("整数ではありません");
return;
}