public int findIndex(int x, int y) {
    if (0 < myImageHeight && myImageY <= y) {
      int index = myArraySize * (y - myImageY) / myImageHeight;
      if (index < myArraySize) return index;
    }
    return -1;
  }
public int findIndex(int x, int y)