We normally like to write complex algorithm to sort an array in Java where many of us overlooked the Arrays class in Java which can be very handy in sorting an array.The Arrays class has a static method called sort which exists in many overloaded versions so you can pass in an array of any primitive type, or pass in an array of Strings or other Objects.