public int readInt(int length) throws IOException {
  if ((length < 0) || (length > 4)) {
    throw new IllegalArgumentException();
  }
  int result=0;
  int byteRead=0;
  if (bigEndian) {
    for (int i=(length - 1) * 8; i >= 0; i-=8) {
      byteRead=stream.read();
      bytesRead++;
      if (byteRead == -1) {
        throw new EOFException();
      }
      result|=(byteRead << i);
    }
  }
 else {
    length*=8;
    for (int i=0; i != length; i+=8) {
      byteRead=stream.read();
      bytesRead++;
      if (byteRead == -1) {
        throw new EOFException();
      }
      result|=(byteRead << i);
    }
  }
  return result;
}

public int readInt ( int length ) throws IOException { if ( ( length < 0 ) || ( length > 4 ) ) { throw new IllegalArgumentException ( ) ; } int result = 0 ; int byteRead = 0 ; if ( bigEndian ) { for ( int i = ( length - 1 ) * 8 ; i >= 0 ; i -= 8 ) { byteRead = stream . read ( ) ; bytesRead ++ ; if ( byteRead == - 1 ) { throw new EOFException ( ) ; } result |= ( byteRead << i ) ; } } else { length *= 8 ; for ( int i = 0 ; i != length ; i += 8 ) { byteRead = stream . read ( ) ; bytesRead ++ ; if ( byteRead == - 1 ) { throw new EOFException ( ) ; } result |= ( byteRead << i ) ; } } return result ; }
read an integer of a certain length from the current stream .
