title: How to increase io performances of this piece of code
body: <p>How can I make this piece of code extremely quick?
  It reads a raw image using RandomAccessFile (in) and write it in a file using DataOutputStream (out)</p>
  
  <pre><code>final int WORD_SIZE = 4;
  byte[] singleValue = new byte[WORD_SIZE];
  long position;
  
      for (int i=1; i&lt;=100000; i++)
      {
               out.writeBytes(i + " ");
  
               for(int j=1; j&lt;=17; j++)
               {
                    in.seek(position);
                    in.read(singleValue);                     
                    String str = Integer.toString(ByteBuffer.wrap(singleValue).order(ByteOrder.LITTLE_ENDIAN).getInt());
                    out.writeBytes(str + " ");
                    position+=WORD_SIZE;      
               }
               out.writeBytes("\n");
      }
  </code></pre>
  
  <p>The inner <code>for</code> creates a new line in the file every 17 elements</p>
  
  <p>Thanks</p>