public static GetStringFromBinary ( byte bytes, bool isFirstTwoByteStoreLength ) : string | ||
bytes | byte | The byte array contains string |
isFirstTwoByteStoreLength | bool | Determine if the byte array contains length |
return | string |
public static string GetStringFromBinary(byte[] bytes, bool isFirstTwoByteStoreLength)
{
StringBuilder stringByteValue = new StringBuilder();
foreach (byte by in bytes)
{
stringByteValue.Append(by.ToString("X2"));
}
if (isFirstTwoByteStoreLength)
{
// Del first four byte which store the byte array length
stringByteValue.Remove(0, 4);
}
return stringByteValue.ToString();
}