class UtmConverter {

    public static GeoCoordinate gridZoneToLatLon(String gridZone) {
        Validate.notEmpty(gridZone, "gridZone must not be empty");
        
        // asked about this here:
        // http://gis.stackexchange.com/questions/84218/get-approximate-lat-long-coordinate-for-utm-grid-zone

        try {
            int zone = Integer.parseInt(gridZone.replaceAll("[A-Z]+", ""));
            if (zone < 1 || zone > 60) {
                throw new IllegalArgumentException("Invalid UTM zone: " + zone + ".");
            }
            char band = gridZone.replaceAll("[0-9]+", "").charAt(0);
            int bandIdx = UtmConverter.UTM_BAND_CHARS.indexOf(band);
            if (bandIdx == -1) {
                throw new IllegalArgumentException("Unknown UTM band: '" + band + "'.");
            }
            double lat = bandIdx * 8 - 76;
            double lng = ((zone - 1) * 6) - 177;

            // for Norway, we need to modify the longitude according to the special rules
            if (band == 'V') {
                if (zone == 31) {
                    lng = 1.5;
                } else if (zone == 32) {
                    lng = 7.5;
                }
            }
            return new ImmutableGeoCoordinate(lat, lng);
        } catch (NumberFormatException e) {
            throw new IllegalArgumentException("'" + gridZone + "' cannot be parsed.");
        }
    }

    private  UtmConverter();

}