Creating a ByteArrayInputStream and DataInputStream just to read a Long seems wasteful; I would just read 8 bytes and shift them together here.