protected static int readInt ( InputStream input , int bytesNumber , boolean bigEndian ) throws IOException { final int oneByte = 8 ; int ret = 0 ; int sv ; if ( bigEndian ) { sv = ( bytesNumber - 1 ) * oneByte ; } else { sv = 0 ; } final int cnt ; if ( bigEndian ) { cnt = - oneByte ; } else { cnt = oneByte ; } for ( int i = 0 ; i < bytesNumber ; i ++ ) { ret |= input . read ( ) << sv ; sv += cnt ; } return ret ; }
Read integer in image data .