question: public static byte [ ] readFile ( File file ) throws IOException { FileInputStream fis = new FileInputStream ( file ) ; try { long size = file . length ( ) ; if ( size > Integer . MAX_VALUE ) throw new IOException ( "File too big" ) ; int len = ( int ) size ; byte data [ ] = new byte [ len ] ; int pos = 0 ; while ( pos < size ) { int read = fis . read ( data , pos , len - pos ) ; pos += read ; } return data ; } finally { fis . close ( ) ; } }
target:  Reads entire binary file 