title: How to read a .dat file in Java and write the data from that dat file into text file?
body: <p>How to read <strong>a .dat file</strong> in Java and write that data from that file into a text file?
  The 101.dat is a binary file.</p>
  
  <pre><code>DataOutputStream dos = new DataOutputStream(new FileOutputStream( "101.dat")); System.out.println("result " + dos.size()); 
  for (int i = 0; i &lt; 100; i++) { 
     dos.writeInt(i); 
     System.out.println(i); 
  } 
  dos.close();
  </code></pre>
  
  <p>The dos.size() method is giving me size 0. But the size should be something</p>