I am trying to convert 2017 to a byte array.
byte[] bytes = new byte[]{0x02, 0x00, 0x01, 0x07}
What are the available c# functions that can help me do something like:
BitLibrary.GetBytes is just used as an example, I am not sure what is available to me/What format the above conversion is in.
bytes[] bytes = BitLibrary.GetBytes(2017)
I first attempted to use BitConverter.GetBytes(2017) but that returned
{byte[4]}
[0]: 225
[1]: 7
[2]: 0
[3]: 0
When I looked for Decimal to Hexadecimal Converters online, 2017 return 7E1.
UPDATE - I am not sure of what this format is called, but from my requirements I am given the following -
2017
byte[] bytes = new byte[]{0x02, 0x00, 0x01, 0x07}
2021
byte[] bytes = new byte[]{0x02, 0x00, 0x02, 0x01}