package org.hwo; public class Unsigned { static public short byte2short(byte by) { short s; if (by < 0) { s = (short)(128 | (by & 0x7f)); } else s = by; return s; } }