JDK8 NB! From: http://www.allinprogram.com/2020/01/java.html set.stream().mapToInt(Integer::valueOf).toArray();