swap32 static method

int swap32(
  1. int value
)

Swap bytes for 32-bit value

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

Implementation

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