### Question:
LatLonPoints { public static 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(); }  static boolean betweenLon(double lon, double lonBeg, double lonEnd); static double lonNormal360(double lon); static double lonNormal(double lon, double center); static double lonNormalFrom(double lon, double start); static double lonNormal(double lon); static double lonDiff(double lon1, double lon2); static double latNormal(double lat); static String latToString(double lat, int ndec); static String lonToString(double lon, int ndec); static boolean isInfinite(ProjectionPoint pt); static double range180(double lon); static String toString(LatLonPoint pt, int sigDigits); static String toString(ProjectionPoint pt, int sigDigits);  }### Answer:
@Test public void testLonToString() { assertThat(LatLonPoints.lonToString(89.501, 3)).isEqualTo("89.501E"); assertThat(LatLonPoints.lonToString(89.501, 2)).isEqualTo("89.50E"); assertThat(LatLonPoints.lonToString(89.501, 1)).isEqualTo("89.5E"); assertThat(LatLonPoints.lonToString(89.401, 0)).isEqualTo("89E"); assertThat(LatLonPoints.lonToString(-199.999, 0)).isEqualTo("160E"); assertThat(LatLonPoints.lonToString(399.999, 1)).isEqualTo("40.0E"); assertThat(LatLonPoints.lonToString(399.999, 2)).isEqualTo("40.00E"); assertThat(LatLonPoints.lonToString(399.999, 3)).isEqualTo("39.999E"); }