added overload to short value encode which takes in a byte array