3 Replies Latest reply on Sep 4, 2008 2:24 PM by 807589

    Convert an 8 byte array to a long (or unsigned integer)

      I'm reading a binary file using RandomAccessFile, seeking and reading chunks of bytes at a time.
      The binary file has a header and i'm interested in reading 8 bytes that denotes the time stamp of the file. The time stamp is 64 bits (8 bytes) long and represents the number of milliseconds since epoch (January 1st 1970).
      How can I convert this byte array of 8 bytes into a long or to an unsigned integer?
      RandomAccessFile raf = new RandomAccessFile(binaryDataFile, "r");
      byte[] captureTimeStamp = new byte[8];
      raf.read(captureTimeStamp, 0, 8);