how to read image file as a 2d array in java and what is use of it?