htons method

int htons(
  1. int hostshort
)

Host to network short

Implementation

int htons(int hostshort) => ((hostshort >> 8) & 0xFF) | ((hostshort & 0xFF) << 8);