No reason to re-implement all that stuff yourself. There are good solutions for reading primitive values from a byte stream. NIO `ByteBuffer`s are one, there is
ByteArrayDataInput
from Guava, etc.
Thread in Slack Conversation
About Guava, Are there real benefits using unsignedBytes instead of promoting byte to int? I've to work with a lot of unsigned values