private static int keyToOffset(int key, int positive, int negative) {
      if (key == positive) return 1;
      if (key == negative) return -1;
      return 0;
    }
private static int keyToOffset(int key, int positive, int negative)