static public void main(String args[]) {
		Ellipsoid earth = new Ellipsoid(6378.137, 1.0 / 298.257222101);

		double lata, longa, latb, longb, ds;
		Double d;

		if (args.length < 4) {
			System.err
					.println("Usage: java TestEllipsoid longa lata longb latb [ds]");
			System.exit(1);
		}

		d = new Double(args[0]);
		longa = d.doubleValue();

		d = new Double(args[1]);
		lata = d.doubleValue();

		d = new Double(args[2]);
		longb = d.doubleValue();

		d = new Double(args[3]);
		latb = d.doubleValue();

		if (args.length == 4)
			ds = 100.0;
		else {
			d = new Double(args[4]);
			ds = d.doubleValue();
		}

		angleFormat.setMaximumFractionDigits(2);
		angleFormat.setMinimumFractionDigits(2);

		distanceFormat.setMaximumFractionDigits(2);
		distanceFormat.setMinimumFractionDigits(2);

		try {
			EllipsoidalArc arc = new EllipsoidalArc(earth);

			arc.setPositionA(DtoR(longa), DtoR(lata));
			arc.setPositionB(DtoR(longb), DtoR(latb));

			double s = arc.calculateDistance();

			System.out.print("Start position: ");
			printAngle(arc.getLongitudeA(), System.out, "East ", "West ");
			System.out.print(", ");
			printAngle(arc.getLatitudeA(), System.out, "North ", "South ");
			System.out.println();

			System.out.print("End position: ");
			printAngle(arc.getLongitudeB(), System.out, "East ", "West ");
			System.out.print(", ");
			printAngle(arc.getLatitudeB(), System.out, "North ", "South ");
			System.out.println();

			System.out.println("Distance is " + distanceFormat.format(s)
					+ " kilometres");

			System.out.print("Forward azimuth is ");
			printAngle(arc.getAzimuthA(), System.out, null, null);
			System.out.println();

			System.out.print("Reverse azimuth is ");
			printAngle(arc.getAzimuthB(), System.out, null, null);
			System.out.println();

			for (double ss = 0.0; ss < s; ss += ds) {
				arc.setDistance(ss);
				arc.calculatePosition();
				System.out.print("S = " + distanceFormat.format(ss) + ": ");
				printAngle(arc.getLongitudeB(), System.out, "East ", "West ");
				System.out.print(", ");
				printAngle(arc.getLatitudeB(), System.out, "North ", "South ");
				System.out.print(" (azimuth = ");
				
				double azimuth = arc.getAzimuthB() + Math.PI;
				if (azimuth > TWO_PI)
					azimuth -= TWO_PI;
				
				printAngle(azimuth, System.out, null, null);
				System.out.println(")");
			}
		} catch (IllegalArgumentException iae) {
			System.err.println("IllegalArgument Exception: " + iae);
			iae.printStackTrace();
			System.exit(1);
		} catch (ArithmeticException ae) {
			System.err.println("Arithmetic Exception: " + ae);
			ae.printStackTrace();
			System.exit(1);
		} catch (IllegalStateException ise) {
			System.err.println("IllegalState Exception: " + ise);
			ise.printStackTrace();
			System.exit(1);
		}
	}