Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
How to concatenate byte array in java?
You ByteArrayOutputStream to write byte arrays and get the result using its toByteArray() method.
import java.io.ByteArrayOutputStream;
import java.io.IOException;
public class Tester {
public static void main(String[] args) throws IOException {
byte[] a = { 1,2,3};
byte[] b = { 4,5,6};
ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos.write(a);
baos.write(b);
byte[] c = baos.toByteArray();
for(int i=0; iOutput
1 2 3 4 5 6
Advertisements
