Use com.google.common.primitives.Ints.toArray to convert Collection objects to arrays.