Converts a 12-bit cell phone number (11 digits before 0, such as 013482339442), converting 12 to 8421 yards, and then combining them into 6 byte arrays, tentatively named BCD6, the conversion method is as follows:
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Text;
Namespace Consoledemo
{public
class BCD6
{public
string Getmobileno (byte[] mobilearray)
{
StringBuilder sb = new StringBuilder ();
for (int i = 0; i < 6; i++)
{
byte bb=mobilearray[i];
Sb. Append (((Byte) (BB >> 4)). ToString ());
Sb. Append ((Byte) ((Byte) (BB << 4) >> 4). ToString ());
}
Return SB. ToString ();
}
Public byte[] ConvertToBCD6 (string mobileno)
{
byte[] mobilearray=new byte[6];
if (mobileno.length!=) return mobilearray;
for (int i = 0; i < 6; i++)
{
Mobilearray[i] = Convert.tobyte (Mobileno.substring (i*2, 2);
}
return mobilearray;
}
}
Console test Code:
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Text;
Namespace Consoledemo
{
class program
{
static void Main (string[] args)
{
byte[] Mobilearray = new Byte[6] {0x01, 0x34, 0x82, 0x33, 0x94, 0x42};
BCD6 bcd6 = new BCD6 ();
Console.WriteLine (Bcd6. Getmobileno (Mobilearray));
byte[] Mobile2 = bcd6. ConvertToBCD6 ("013482339442");
Console.WriteLine (Bcd6. Getmobileno (Mobile2));
Console.read ();}}