import java.util.*; import java.util.stream.Collectors; // java 8+ List<Integer> list = Arrays.stream(nums).boxed().collect(Collectors.toList()); // java 16+ List<Integer> list = Arrays.stream(nums).boxed().toList();