//分解int int readInt(byte [] buf, int beginPos) { result |= buf[beginPos]&0xff; result <<= 8; result |= buf[beginPos + 1]&0xff; result <<= 8; result |= buf[beginPos + 2]&0xff; result <<= 8; result |= buf[beginPos + 3]&0xff; return result; }//分解String String readString(byte []buf, int beginPos, int endPos) { return new String(buf, beginPos, endPos); }
//分解int
int readInt(byte [] buf, int beginPos)
{
result |= buf[beginPos]&0xff;
result <<= 8;
result |= buf[beginPos + 1]&0xff;
result <<= 8;
result |= buf[beginPos + 2]&0xff;
result <<= 8;
result |= buf[beginPos + 3]&0xff;
return result;
}//分解String
String readString(byte []buf, int beginPos, int endPos)
{
return new String(buf, beginPos, endPos);
}