public static Version max ( Version ... versions ) { if ( versions . length == 0 ) { throw new IllegalArgumentException ( "At least one version needs to be provided for maximum calculation." ) ; } Version maximum = versions [ 0 ] ; for ( int index = 1 ; index < versions . length ; ++ index ) { Version version = versions [ index ] ; if ( maximum . compareTo ( version ) < 0 ) { maximum = version ; } } return maximum ; }
This class returns the maximum version of the provided versions within the array .