Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Adelina Fischer   on May 13 In Java Category.

  
Question Answered By: Benny Torres   on May 13

your statements will not work

1: c = a;
2: c[a.length + 1] = b;

i guess in 2: you must be getting ArrayIndexOutOfBoundsException


following will work


byte [] c= new byte[a.length+1];
for(int i=0;i<a.length;i++) c[i]=a[i];
c[a.length]=b;

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on how to append a byte to an array of bytes Or get search suggestion and latest updates.


Tagged: