int[] nums
is an Object
. You have two ways to solve this:
Change the variable to
Integer[]
.Create an additional method to support
int[]
.
In case you're not doing this for homework/exercise/specific sort algorithm purpose, use Arrays#sort(int[])
or Arrays#sort(Object[] array)
instead.