// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.io.*;

public class ReadBin {
   public static int revbyte(int v) {
      return ((v >> 24) & 0x000000FF)
         | ((v >> 8) & 0x0000FF00)
         | ((v << 8) & 0x00FF0000)
         | ((v << 24) & 0xFF000000);
   }
   public static double revbyte(long v) {
      long v2 =
         ((v >> 56) & 0x00000000000000FFL)
            | ((v >> 40) & 0x000000000000FF00L)
            | ((v >> 24) & 0x0000000000FF0000L)
            | ((v >> 8) & 0x00000000FF000000L)
            | ((v << 8) & 0x000000FF00000000L)
            | ((v << 24) & 0x0000FF0000000000L)
            | ((v << 40) & 0x00FF000000000000L)
            | ((v << 56) & 0xFF00000000000000L);
      return Double.longBitsToDouble(v2);
   }
   public static void main(String[] args) throws Exception {
      FileInputStream fis = new FileInputStream("C:\\csbin.dat");
      DataInputStream dis = new DataInputStream(fis);
      byte[] b = new byte[dis.readByte()];
      dis.read(b);
      String sv = new String(b, "UTF-8");
      int iv = revbyte(dis.readInt());
      boolean bv = dis.readBoolean();
      double xv = revbyte(dis.readLong());
      dis.close();
      fis.close();
      System.out.println(sv + " " + iv + " " + bv + " " + xv);
   }
}
