Java Arrays convert array to List via Stream
import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; public class Main { public static void main(String[] args) { Integer[] values = {12, 19, 5, 10, 3, 17, 1, 4, 8, 6}; // display original values System.out.printf("Original values: %s%n", Arrays.asList(values)); // sort values in ascending order with streams List<Integer> list = Arrays.stream(values) .sorted()//w ww . j a v a 2 s. com .collect(Collectors.toList()); System.out.println(list); } }