Java tutorial
//package com.java2s; //License from project: Apache License public class Main { public static final String DIRECTION_NORTH = "N"; public static final String DIRECTION_SOUTH = "S"; public static final String DIRECTION_EAST = "E"; public static final String DIRECTION_WEST = "W"; public static double parseNmeaFormat(String degrees, String direction) { double latlong = 0.0; double temp1 = Double.parseDouble(degrees); double temp2 = Math.floor(temp1 / 100); double temp3 = (temp1 / 100 - temp2) / 0.6; if (DIRECTION_SOUTH.equals(direction) || DIRECTION_WEST.equals(direction)) { latlong = -(temp2 + temp3); } else if (DIRECTION_NORTH.equals(direction) || DIRECTION_EAST.equals(direction)) { latlong = (temp2 + temp3); } return latlong; } }