This phrase will read the file specified by fileName into the bytes byte array. Notice that the file.length() method returns us the length of the file in bytes as a long value, but we must use an int value to initialize the byte array, so we cast the long value to an int value. In a real program, you would probably want to be sure that the length value would indeed fit into an int type before blindly casting it. Using the read() method of the InputStream, we continue to read in bytes from the file until either the byte array is filled up, or there are no more bytes to read from the file. |