static public String lonToString ( double lon , int ndec ) { double wlon = lonNormal ( lon ) ; boolean is_east = ( wlon >= 0.0 ) ; if ( ! is_east ) wlon = - wlon ; String f = "%." + ndec + "f" ; Formatter latBuff = new Formatter ( ) ; latBuff . format ( f , wlon ) ; latBuff . format ( "%s" , is_east ? "E" : "W" ) ; return latBuff . toString ( ) ; }
Make a nicely formatted representation of a longitude eg 120 . 3W or 99 . 99E .