I have an array name "asset" with 4 number. I then converted it to be stored in arraylist. Then with the arraylist copy to another array. Is this algorithm correct? After adding 5 the array should be able to show 5 number now
List assetList = new ArrayList();
String[] asset = {"1", "2", "3", "4"};
Collections.addAll(assetList, asset);
assetList.add("5");
String [] aListToArray = new String[assetList.size()];
aListToArray.toArray(aListToArray);