private static int IRIGHT_SHIFT(int x, int shft) { if (x < 0) return (x >> shft) | (~0) << (16 - shft); return (x >> shft); }