public static short HostToNetworkOrder(short host) { #if BIGENDIAN return host; #else return (short)((((int)host & 0xFF) << 8) | (int)((host >> 8) & 0xFF)); #endif }