import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; public class WrapperExample { public static void main(String[] args) { int i = 10; Integer someInt = i; // boxing int j = someInt; // unboxing ArrayList list = new ArrayList(); for (int k = 0; k < 10; k ++) { int rand = (int) (Math.random() * 1000); list.add(rand); // rand is boxed into an Integer object } // print the list System.out.println("list = " + Arrays.toString(list.toArray())); // sort the list Collections.sort(list); // print the list System.out.println("list = " + Arrays.toString(list.toArray())); } }