What is the 32-bit representation of minus one?

A good answer might be:

32 one-bits, or 11111111111111111111111111111111

BufferedOutputStream

Here is the program again, this time with a BufferedOutputStream placed in the stream. In a program that writes only a few bytes, buffering adds little efficiency. This program writes 512*4 == 2048 bytes. Probably not really enough to worry about, but for practice let us use a buffer.

import java.io.*;
class WriteInts
{
 public static void main ( String[] args )
 {
   String fileName = "intData.dat" ;

   try
   {      
     DataOutputStream out = new DataOutputStream(
         new BufferedOutputStream(
         new FileOutputStream( fileName )));

     for ( int j=0; j<512; j++ )
       out.writeInt( j );  

     out.close();
   }
   catch ( IOException iox )
   {
     System.out.println("Problem writing " + fileName );
   }
 }
}

DataOutputStream has methods for writing out short, long, double and other data.

QUESTION 7:

What do you suppose the method that writes a double is called?