public static boolean validateKeyIndexInput(final Context context, final String input) throws IllegalArgumentException {

        if (TextUtils.isEmpty(input)) {
            throw new IllegalArgumentException(context.getString(R.string.error_empty_key_index));
        }

        final int keyIndex;

        try {
            keyIndex = Integer.parseInt(input);
        } catch (NumberFormatException ex) {
            throw new IllegalArgumentException(context.getString(R.string.error_invalid_key_index));
        }
        if (isValidKeyIndex(keyIndex)) {
            throw new IllegalArgumentException(context.getString(R.string.error_invalid_key_index));
        }

        return true;
    }
Validates the Key Index input

@param context context
@param input   Key Index input
@return true if the Key Index 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