public static void checkArrayLength(String parameterName, int actualLength,
            int expectedLength) {
        if (actualLength != expectedLength) {
            throw Exceptions.IllegalArgument(
                    "Array %s should have %d elements, not %d", parameterName,
                    expectedLength, actualLength);
        }
    }
public static void checkArrayLength ( String parameterName , int actualLength , int expectedLength ) { if ( actualLength != expectedLength ) { throw Exceptions . IllegalArgument ( "Array %s should have %d elements, not %d" , parameterName , expectedLength , actualLength ) ; } }
Check that the parameter array has exactly the right number of elements.

@param parameterName
The name of the user-supplied parameter that we are validating
so that the user can easily find the error in their code.
@param actualLength
The actual array length
@param expectedLength
The expected array length