[Huawei OD test questions] TLV coding (java) 100% pass rate [2023 (B volume) 100 points]

TLV encoding

topic description

TLV encoding is encoded in TagLengthValue format.
The cells in a code stream are identified by tags, and the tag is the only one in the code stream that does not repeat.
length represents the length of the cell value, and value represents the value of the cell.
The code stream starts with the tag of a certain cell, and the tag occupies one character. section, length occupies two bytes, and the byte order is little endian.
Now given the code stream encoded in tlv format and the cell tag to be decoded, please output the value of the cell.

The hexadecimal characters of the input code stream do not include lowercase letters;
and the output hexadecimal string is required not to contain lowercase letters;
the maximum length of the code stream string does not exceed 50,000 bytes.

enter description

The first line is a string, indicating the tag of the cell to be decoded;
the second line is a string, indicating the hexadecimal code stream to be decoded;
the bytes are separated by spaces.

output description

Output a character string representing the hexadecimal value of the cell to be decoded.

example one

enter

31
32 01 00 AE 90 02 00 01 02 30 03 00 AB 32 31</

Guess you like

Origin blog.csdn.net/weixin_45541762/article/details/132460639