Java tutorial
//package com.java2s; public class Main { /** * convert longitude from DMS (Degrees, Minutes, Seconds) to DD (Decimal Degrees) * * @param int longDeg - longitude degree value * @param double longMin - longitude minute value * @param double longSec - longitude second value * @param String longDir - longitude direction (west or east) * @return double - double values for given longitude */ public static double convertLongDMStoDD(int longDeg, int longMin, double longSec, String longDir) { double longitude = longDeg + (longMin / new Double(60)) + (longSec / new Double(3600)); if (longDir.equalsIgnoreCase("w")) longitude = -longitude; return longitude; } }