code: public int ZoomForPixelSize( int pixelSize ) {
          for( int i = 0; i < 30; i++ ) {
              if (pixelSize > Resolution(i)) {
                  if (i != 0) {
                      return i - 1;
                  } else {
                      return 0; // We don't want to scale up
                  }
              }
          }
          return 0;
      }
docs: Maximal scaledown zoom of the pyramid closest to the pixelSize
  
  @param pixelSize
  @return