code: public static double pixelXToLongitude(double pixelX, long mapSize) {
          if (pixelX < 0 || pixelX > mapSize) {
              throw new IllegalArgumentException("invalid pixelX coordinate " + mapSize + ": " + pixelX);
          }
          return 360 * ((pixelX / mapSize) - 0.5);
      }
docs: Converts a pixel X coordinate at a certain map size to a longitude coordinate.
  
  @param pixelX  the pixel X coordinate that should be converted.
  @param mapSize precomputed size of map.
  @return the longitude value of the pixel X coordinate.
  @throws IllegalArgumentException if the given pixelX coordinate is invalid.