plenty of methods for copying to array in HERE - in fact you have to create new array with size+1, as usual arrays have fixed size. some example method:
static <T> T[] append(T[] arr, T element) {
final int N = arr.length;
arr = Arrays.copyOf(arr, N + 1);
arr[N] = element;
return arr;
}
your call
append(info, data1);
BUT I must aware you that this isn't well-perfomance way, it would be better to use ArrayList for info instead of not-so-efficient and fixed size array. copying whole array to new one with size N + 1 (and additional item) is in fact heavy operation and you want to use it in while method...
if you would have
private ArrayList<String> info = new ArrayList<>();
then you can simply call add inside while safely
info.add(data1);
List<String>which can be appended to.info[]isn't a type in your case but just a name along with the bad practice (my opinion) of putting the type info around it. Better would beString[] infoso the type isString[]. That being said, there's theList.toArray()method which you might want to read up on. The call could be something likeinfo = yourList.toArray(new String[0]);but note that this replaces info as you can't append to an array.