How to calculate meta length in characters:
private static string GetMetaLengthBin(int nDataLength)
{
//Steps to calculate the meta length in characters
//STEP 1: Get the div part. Divide data length by 256
//STEP 2: Get the Modulus part. Take modulus of Data length by 256
//STEP 3: Convert into characters, concat and return.
string strLengthInChars = string.Empty;
int nPartDiv = nDataLength / 256;
int nPartMod = nDataLength % 256;
char chDiv = Convert.ToChar(nPartDiv);
char chMod = Convert.ToChar(nPartMod);
strLengthInChars = chDiv.ToString() + chMod.ToString();
return strLengthInChars;
}