swap16 static method

int swap16(
  1. int value
)

Swap bytes for 16-bit value

  • value: The 16-bit value to swap bytes for Returns the value with swapped bytes

Implementation

static int swap16(int value) {
  return ((value & 0xFF) << 8) | ((value >> 8) & 0xFF);
}