There is a ByteBuffer class in jave which is almost like a byte array but already implements functionality to put other data types like Integers, Floats, Doubles, etc inside.