public static boolean validateKeyInput(@NonNull final String key) throws IllegalArgumentException {
        if (TextUtils.isEmpty(key)) {
            throw new IllegalArgumentException("Key cannot be empty!");
        } else if (!key.matches(PATTERN_KEY)) {
            throw new IllegalArgumentException("key must be a 32-character hexadecimal string!");
        }

        return true;
    }
Validates the key input

@param key key
@return true if the Key is a valid value
@throws IllegalArgumentException in case of an invalid was entered as an input and the message containing the error
mesh/src/main/java/no/nordicsemi/android/mesh/utils/MeshParserUtils.java