public static short unsignedByteToShort(byte b){
  if ((b & 0x80) == 0x80)   return (short)(128 + (b & 0x7f));
 else   return (short)b;
}

public static short unsignedByteToShort ( byte b ) { if ( ( b & 0x80 ) == 0x80 ) return ( short ) ( 128 + ( b & 0x7f ) ) ; else return ( short ) b ; }
converts an unsigned byte to a short . by default , java assumes that a byte is signed .
