Just read them as short
(2 bytes - Java) and int
(4 bytes - Java) in your
Java code. You will not lose any information. If you need to output them later,
do a conversion so that you don't output signed numbers.
Given their names: File Source ID
and Header Size
I doubt you
will do any arithmetic operations on them. If you do, be careful.
Alternatively, you can read them both in long
(8 bytes in Java),
and not worry about arithmetic operations as they will not cause issues.
Alternatively, you can read your values as byte arrays in Java,
and then transform them to the proper types in your Java code.
This is probably the most explicit and clean solution.
But it requires more coding.