How to add new element to Varargs?
Use Arrays.copyOf(...)
:
String[] extra2 = Arrays.copyOf(extra, extra.length+1);
extra2[extra.length] = description;
object_for_text = getObject(find_arguments,extra2);
To expand on some of the other answers here, the array copy could be done a bit faster with
String[] newArr = new String[extra.length + 1];
System.arraycopy(extra, 0, newArr, 0, extra.length);
newArr[extra.length] = Description;