I have 2 byte arrays. I am concatenating using system.arraycopy. It is not throwing exception but the resulting stream is displaying only 2nd array data
byte mainPdf[] = generatePDF(creditAppPDFurl, cifNumber,appRefId,pdfid1,appTransId);
byte supportingPdf[] = generateSupportingDocPDF();
byte[] destination = new byte[mainPdf.length + supportingPdf.length];
System.arraycopy(mainPdf, 0, destination, 0, mainPdf.length);
System.arraycopy(supportingPdf, 0, destination, mainPdf.length, supportingPdf.length);
pdfInputStreamData = new ByteArrayInputStream(destination);
pdfInputStreamData is displaying only supportingPdf data
Your code is fine and the error is somewhere else. In particular, the original arrays probably don't contain the information you expect.
You can try this simple example to confirm that the array concatenation part of your code works:
prints
[1, 2, 3, 4, 5, 6].