CodePudding user response:
This research the hair will be less ~CodePudding user response:
Less to study , the great god give directionsCodePudding user response:
//code
Byte [] SetDate (decimal radian)
{
Int I, j;
String [] s=radian. ToString (). The Split ('. ');
Byte [] rs=new byte [5].
Rs [0]=0 XFF;
If (s.L ength==2)
{
I=int. Parse [1] (s);
I=I & lt; <10;
I=I | int. Parse (s [0]);
}
The else
{
I=int. Parse [1] (s);
}
For (j=3; J & gt; 0; J -)
Rs [j]=(byte) (I & gt;> (8 * (3 - j)));
Rs [4]=0;
For (j=0; J & lt; 4. J++)
Rs [4]=(byte) (rs + rs [j] [4]);
Return the rs;
}
//decoding
A decimal GetData (byte [] dat)
{
int i;
String s;
//verification not wrote
i=0;
For (I=1; I & lt; 4. I++)
{
I=I | dat [I];
I=I & lt; <8;
}
S=(I & amp; 0 x3ff). The ToString ();
S=s + ". ";
S=s + (I & gt;> 10). The ToString ();
Return a decimal. Parse (s);
}
CodePudding user response:
Byte [] SetDate (decimal radian)
{
Int I, j;
String [] s=radian. ToString (). The Split ('. ');
Byte [] rs=new byte [5].
Rs [0]=0 XFF;
If (s.L ength==2)
{
I=int. Parse [1] (s);
I=I & lt; <10;
I=I | int. Parse (s [0]);
}
The else
{
I=int. Parse [1] (s);
}
For (j=3; J & gt; 0; J -)
Rs [j]=(byte) (I & gt;> (8 * (3 - j)));
Rs [4]=0;
For (j=0; J & lt; 4. J++)
Rs [4]=(byte) (rs + rs [j] [4]);
Return the rs;
}
CodePudding user response:
Thank you thank you let me have a try,CodePudding user response:
The else{
I=int. Parse (s [0]);
}