static int reverseBits(int i) { int j = 0; repeat 16 { j = (j << 1) | (i >> 15); i >>>= 1; } ret j; }