how to use arraylist.toarray code example Example: array to arraylist new ArrayList<>(Arrays.asList(array));