code: public static int pixelYToTileY(double pixelY, byte zoomLevel, int tileSize) {
          return (int) Math.min(Math.max(pixelY / tileSize, 0), Math.pow(2, zoomLevel) - 1);
      }
docs: Converts a pixel Y coordinate to the tile Y number.
  
  @param pixelY    the pixel Y coordinate that should be converted.
  @param zoomLevel the zoom level at which the coordinate should be converted.
  @return the tile Y number.