public static int convert24BitsToInt(@NonNull final byte[] byteArray, final int offset) {
        if (byteArray.length - offset < 3)
            throw new IllegalArgumentException("Invalid length, byte array must be 3-bytes long.");
        return (((byteArray[offset] & 0xFF) << 16) | ((byteArray[offset + 1] & 0xFF) << 8) | (byteArray[offset + 2] & 0xFF));
    }
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