Your check instanceofdoes not really tell the compiler what it inputArrayis Integer[]- the compile time type is still simple E[].
However, you can easily distinguish, and at this point it will work:
if (inputArray instanceof Integer[]) {
Integer[] integers = (Integer[]) inputArray;
Collections.sort(Arrays.asList(integers), ...);
}
Or even just:
if (inputArray instanceof Integer[]) {
Collections.sort(Arrays.asList((Integer[]) inputArray), ...);
}
However, when you have a general method, and then take specific actions for certain types, you should at least consider whether you really need a general method.