Problem: Reading raw input using a BufferedInputStream is done one byte at a time. So line.read() returns an int type, but it doesn't actually read an integer. Here's roughly the way I do it:
BufferedInputStream in = new BufferedInputStream(System.in, BUFFER_SIZE); //buffer size is usually between 1000000 and 5000000, I tweak it to see what makes it the fastest
int num = 0;
int read;
while ((read = in.read()-'0') >= 0)
num = num*10 + read;
This will read the number and one extra character (possibly a newline or a space) for you. Do that 6 times for your six numbers, and the line should be covered.
The reason you were getting 49 for 1 is that '1' is ascii 49 