package cn.org.hentai.jtt1078.app; public class Test { public static void main(String[] args) { byte[] buffer = { 48, 49, 99, 100, -127, 98, 0, 0, 0, 0, 0, 0, 1, 51, 7, 68, 67, -128, 1, 1, 0, 0, 1, -104, 53, -33, -2, 57, 0, 0, 0, 100, 3, -74, 0, 0, 0, 1, 103, 77, 0, 10, -106, 84, 2, -128, 45, -120, 0, 0, 0, 1, 104, -18, 60, -128, 0, 0, 0, 1, 101, -120, -128, 64, 5, -1, -96, -32, 64, 111, 81}; /* byte[] buffer = { 48, 49, 99, 100, -127, 98, 0, 2, 2, 2, 50,80, 2, 32, 1, 3,0, 0, 1, -104, 55, -112, 118, 111, 0, 0, 0, 0, 3, -74, 114, 66, 70, -114, -16, -109, 45, 86, -20,};*/ int position = 28; int h = buffer[position] & 0xff; int l = buffer[position + 1] & 0xff; int result = ((h << 8) | l) & 0xffff; System.out.println("result = " + result); } }