I am using the following code to convert a Set to int[]
Set<Integer> common = new HashSet<Integer>();
int[] myArray = (int[]) common.toArray();
the I got the following error:
error: incompatible types: Object[] cannot be converted to int[]
What would be the most clean way to do the conversion without adding element one by one using a for loop? Thanks!