ReadIntExample -- using DataInputStream.readInt correctly and incorrectly to read int values from a file.
To see this example in action:
  1. Compile the Java source file, ReadIntExample.java:
    	javac ReadIntExample.java
    
  2. Run the class:
    	java ReadIntExample
    
Output:
    out.writeInt(1728);
      in.readInt() = 1728
    out.writeBytes("1728");
      in.readInt() = 825700920
    out.writeChars("1728");
      in.readInt() = 3211319

The source.