Here you can find the source of degreesMinSecToDegrees(String position)
public static double degreesMinSecToDegrees(String position) throws StringIndexOutOfBoundsException
//package com.java2s; /**/*from w w w . j a va 2s . c om*/ * Offers various useful methods related to geopositionning. * <p>License: This library is under the GNU Lesser General Public License</p> * * @author Praplan Christophe * @author Velen Stephane * @version 1.0 <p>Geneva, the 23.03.2006 */ public class Main { public static double degreesMinSecToDegrees(String position) throws StringIndexOutOfBoundsException { double result; try { if (position.charAt(position.length() - 1) == 'W' || position.charAt(position.length() - 1) == 'E') { result = Double.parseDouble(position.substring(7, 12)) / 60; result = (Double.parseDouble(position.substring(4, 6)) + result) / 60; result += Double.parseDouble(position.substring(0, 3)); } else { result = Double.parseDouble(position.substring(6, 11)) / 60; result = (Double.parseDouble(position.substring(3, 5)) + result) / 60; result += Double.parseDouble(position.substring(0, 2)); } if (position.charAt(position.length() - 1) == 'W' || position.charAt(position.length() - 1) == 'S') return -result; else return result; } catch (StringIndexOutOfBoundsException e) { throw new StringIndexOutOfBoundsException("Bad entry format"); } } }