Here you can find the source of degreesToDecimal(String input)
public static double degreesToDecimal(String input)
//package com.java2s; //License from project: LGPL public class Main { public static double degreesToDecimal(String input) { char direction = input.charAt(0); int degrees; int minutes; int seconds; if (direction == 'E' || direction == 'W') { degrees = Integer.parseInt(input.substring(1, 4)); minutes = Integer.parseInt(input.substring(4, 6)); seconds = Integer.parseInt(input.substring(6)); } else {/*from ww w. j a v a2 s .c o m*/ degrees = Integer.parseInt(input.substring(1, 3)); minutes = Integer.parseInt(input.substring(3, 5)); seconds = Integer.parseInt(input.substring(5)); } double decimal = degrees + (float) minutes / 60 + (float) seconds / 3600; if (direction == 'W' || direction == 'S') { decimal *= -1; } return decimal; } }