title: random access file in java
body: <p>I have the following fields:</p>
  
  <ul>
  <li>Inventory control (16 byte record)
  
  <ul>
  <li>Product ID code (int – 4 bytes)</li>
  <li>Quantity in stock (int – 4 bytes)</li>
  <li>Price (double – 8 bytes)</li>
  </ul></li>
  </ul>
  
  <p>How do I create a fixed length random access file using the above lengths? I tried some examples online, but I either get an EOF exception or random address values when I try to access them.</p>
  
  <p>I tried some more examples and couldn't understand the concept very well. I'm trying a project with it and will try to explore more on it.</p>
  
  <p>Here is some example data. There might be holes in the data where <code>No. in stock</code> could be <code>23 == 023</code>.</p>
  
  <pre><code>          Quantity
  ID. No.   In Stock   Price
  
  -------   --------   ------
   1001       476      $28.35
   1002       240      $32.56
   1003       517      $51.27
   1004       284      $23.75
   1005       165      $32.25
  </code></pre>
  
  <p>Thanks for the help.</p>