What does :
System.in.read()
return ? The documentation says :
Returns: the next byte of data, or -1 if the end of the
System.in.read() reads just one byte.
49 is the Unicode point value for 1.
Try to print:
System.out.println((char)49);
This will help you to understand it more.