method to get length of message
more static functions to help decode messages