47 lines
848 B
Java
47 lines
848 B
Java
|
|
public class test_bytes {
|
|
|
|
static byte[] bb = new byte[8];
|
|
static int[] ii;
|
|
static float[] ff;
|
|
static int bbi = 8;
|
|
|
|
public static int unToBy(byte a)
|
|
{
|
|
int b = a & 0xFF;
|
|
return b;
|
|
}
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
bb[0]= (byte) 0xF6;
|
|
bb[1]= (byte) 0x43;
|
|
bb[2]= (byte) 0xF6;
|
|
bb[3]= (byte) 0x43;
|
|
bb[4]= (byte) 0xF6;
|
|
bb[5]= (byte) 0x43;
|
|
bb[6]= (byte) 0xF6;
|
|
bb[7]= (byte) 0x43;
|
|
|
|
|
|
|
|
AdsBuf2Float b2i = new AdsBuf2Float(bb,bbi,0);
|
|
ff = b2i.convert(bb);
|
|
System.out.println(b2i.multi);
|
|
//int i = bb[1]*256 + unToBy(bb[0]);
|
|
for (int j = 0; j < bbi/2; j++) {
|
|
System.out.println(ff[j]);
|
|
}
|
|
bb[2] = (byte) 0x50;
|
|
ff = b2i.convert(bb);
|
|
System.out.println(b2i.multi);
|
|
//int i = bb[1]*256 + unToBy(bb[0]);
|
|
for (int j = 0; j < bbi/2; j++) {
|
|
System.out.println(ff[j]);
|
|
}
|
|
|
|
}
|
|
|
|
}
|