Partitioning array elements into two subsets
Unless it is a homework for sort algorithm study :


Manage ArrayList and load your list of number,
put all number&lt;=x in a new ArrayList,
delete them from the original ArrayList,
finish with .addAll(..), to concatenate if needed.


Knowing that VM is optmized, it would be interesting to compare performance of this approach with your one.