public static void checkNotNegativeNumber ( final Number number , final String name ) throws IllegalArgumentException { if ( number == null || number . doubleValue ( ) < 0 ) { throw new IllegalArgumentException ( "Expecting a positive or zero number for " + name ) ; } }
Enforces that the number is not negative .