### Question:
SphericalUtil { public static double computeHeading(LatLng from, LatLng to) { double fromLat = toRadians(from.latitude); double fromLng = toRadians(from.longitude); double toLat = toRadians(to.latitude); double toLng = toRadians(to.longitude); double dLng = toLng - fromLng; double heading = atan2( sin(dLng) * cos(toLat), cos(fromLat) * sin(toLat) - sin(fromLat) * cos(toLat) * cos(dLng)); return wrap(toDegrees(heading), -180, 180); } private  SphericalUtil(); static double computeHeading(LatLng from, LatLng to); static LatLng computeOffset(LatLng from, double distance, double heading); static LatLng computeOffsetOrigin(LatLng to, double distance, double heading); static LatLng interpolate(LatLng from, LatLng to, double fraction); static double computeDistanceBetween(LatLng from, LatLng to); static double computeLength(List<LatLng> path); static double computeArea(List<LatLng> path); static double computeSignedArea(List<LatLng> path);  }### Answer:
@Test public void testHeadings() { assertEquals(SphericalUtil.computeHeading(up, down), -180, 1e-6); assertEquals(SphericalUtil.computeHeading(down, up), 0, 1e-6); assertEquals(SphericalUtil.computeHeading(front, up), 0, 1e-6); assertEquals(SphericalUtil.computeHeading(right, up), 0, 1e-6); assertEquals(SphericalUtil.computeHeading(back, up), 0, 1e-6); assertEquals(SphericalUtil.computeHeading(down, up), 0, 1e-6); assertEquals(SphericalUtil.computeHeading(front, down), -180, 1e-6); assertEquals(SphericalUtil.computeHeading(right, down), -180, 1e-6); assertEquals(SphericalUtil.computeHeading(back, down), -180, 1e-6); assertEquals(SphericalUtil.computeHeading(left, down), -180, 1e-6); assertEquals(SphericalUtil.computeHeading(right, front), -90, 1e-6); assertEquals(SphericalUtil.computeHeading(left, front), 90, 1e-6); assertEquals(SphericalUtil.computeHeading(front, right), 90, 1e-6); assertEquals(SphericalUtil.computeHeading(back, right), -90, 1e-6); }