public static void range ( double parameter , double lowEndpoint , double highEndpoint , String name ) throws IllegalArgumentException { if ( lowEndpoint > parameter || parameter > highEndpoint ) { throw new IllegalArgumentException ( String . format ( "%s parameter is not in range [%d, %d]." , name , lowEndpoint , highEndpoint ) ) ; } }
Test if numeric parameter is in a given range . Parameter is considered in range if is greater or equal with lower endpoint and smaller or equal higher endpoint .