What is wrong with this conversion?
public int getTheNumber(int[] factors) {
ArrayList f = new ArrayList(Arrays.asList(factors));
Co
Arrays.asList(factors) returns a List, not a List. Since you're doing new ArrayList instead of new ArrayList you don't get a compile error for that, but create an ArrayList which contains an int[] and you then implicitly cast that arraylist to ArrayList. Of course the first time you try to use one of those "Integers" you get an exception.