### Question:
GeoUtils { public static double parseDms(String dmsString) { Validate.notEmpty(dmsString, "dmsString must not be empty"); Matcher matcher = PATTERN_PARSE_DMS.matcher(dmsString); if (!matcher.matches()) { throw new NumberFormatException("The string " + dmsString + " could not be parsed in DMS format."); } double degrees = Double.parseDouble(matcher.group(1)); int sign; String ws = matcher.group(4); if (ws != null) { sign = "W".equals(ws) || "S".equals(ws) || "West".equals(ws) || "South".equals(ws) ? -1 : 1; } else { sign = matcher.group(1).startsWith("-") ? -1 : 1; } double minutes = matcher.group(2) != null ? Double.parseDouble(matcher.group(2)) : 0; double seconds = matcher.group(3) != null ? Double.parseDouble(matcher.group(3)) : 0; return sign * (Math.abs(degrees) + minutes / 60. + seconds / 3600.); } private  GeoUtils(); static GeoCoordinate getMidpoint(Collection<? extends GeoCoordinate> coordinates); static GeoCoordinate getCenterOfMinimumDistance(Collection<? extends GeoCoordinate> coordinates); static double parseDms(String dmsString); static double approximateDistance(double lat1, double lng1, double lat2, double lng2); static double approximateDistance(GeoCoordinate c1, GeoCoordinate c2); static double computeDistance(double lat1, double lng1, double lat2, double lng2); static boolean isValidCoordinateRange(double lat, double lng); static void validateCoordinateRange(double lat, double lng); static double normalizeLatitude(double lat); static double normalizeLongitude(double lng); static double getLargestDistance(Collection<? extends GeoCoordinate> coordinates); static final String DMS; static final double EARTH_RADIUS_KM; static final double EARTH_CIRCUMFERENCE_KM; static final double EARTH_MAX_DISTANCE_KM; static final Distance<GeoCoordinate> DISTANCE; }### Answer:
@Test public void testDmsToDec() { assertEquals(40, GeoUtils.parseDms("40°"), 0); assertEquals(-73.94, GeoUtils.parseDms("73°56.4′W"), 0); assertEquals(40.446195, GeoUtils.parseDms("40:26:46.302N"), 0.05); assertEquals(40.446195, GeoUtils.parseDms("40d 26′ 47″ N"), 0.05); assertEquals(40.446195, GeoUtils.parseDms("40°26′47″N"), 0.05); assertEquals(33.676176, GeoUtils.parseDms("33.676176° N"), 0.05); assertEquals(33.575, GeoUtils.parseDms("33°34'30\" N"), 0.05); assertEquals(42.443333, GeoUtils.parseDms("42° 26' 36'' N"), 0.05); assertEquals(42.7335, GeoUtils.parseDms("42° 44′ 0.6″ N"), 0.05); assertEquals(42.904722, GeoUtils.parseDms("42°54'17\" N"), 0.05); assertEquals(39.716667, GeoUtils.parseDms("39°43' North"), 0.05); assertEquals(42.904722, GeoUtils.parseDms("42°54'17\" N"), 0.05); assertEquals(36.466667, GeoUtils.parseDms("36º28' N"), 0.05); }