+4  A: 

You invoke

out.write(avg)

to write the int avg to the output.

This will invoke the method BufferedWriter.write(int); this will write out the character with the Unicode code point avg. This is probably not what you want ;-).

To print the number avg in decimal format, use

out.write(String.valueOf(avg))
sleske
Wooohooo!!! That was the right call :)
playcat