The Forgotten bytes - Johnson-TONG/CreditCard-Service GitHub Wiki

The decimal number of 25 in byte format : 1 1 0 0 1 0 0 0, each byte has 8 bits.

byte[] bytes = { 0, 0, 0, 25 };
if (BitConverter.IsLittleEndian)
  Array.Reverse(bytes);
int i = BitConverter.ToInt32(bytes, 0);
Console.WriteLine("int: {0}", i);
// Output: int: 25


The decimal number of 201805978 in byte format is 00001100 00000111 01010000 10011010, which has 4 group of 8 bits

with the Hex format is : 0C 07 50 9A

byte[] bytes = BitConverter.GetBytes(201805978);
Console.WriteLine("byte array: " + BitConverter.ToString(bytes));
// Output: byte array: 9A-50-07-0C

⚠️ **GitHub.com Fallback** ⚠️