Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Using the standard library
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
outStream.write(byte_1);
outStream.write(byte_2);
byte[] mass = outStream.toByteArray();
byte[] mass = new byte[byte_1.length() + byte_2.length()]
System.arrayCopy(byte_1, 0, mass, 0, byte_1.length());
System.arrayCopy(byte_2, 0, mass, byte_1.length(), byte_2.length());
In any case, you need to create a new array with a length of byte_1.length + byte_2.length
Again, I recommend using ready-made solutions
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question