...
Code Block | ||
---|---|---|
| ||
DataInputStream dis = new DataInputStream(
new FileInputStream("data.txt")); // Little-endian data might be read as big-endian
int serialNumber = dis.readInt();
|
...
Code Block | ||
---|---|---|
| ||
DataInputStream dis = new DataInputStream(
new FileInputStream("data.txt"));
byte[] buffer= new byte[4];
int bytesRead = dis.read(buffer); // Bytes are read into buffer
int serialNumber = ByteBuffer.wrap(buffer).order(ByteOrder.LITTLE_ENDIAN).getInt();
|
...