opendap/src/main/java/opendap/util/Getopts.java
public static void main(String args[]) {
        int i;
        String args1[] = new String[args.length - 1];
        System.arraycopy(args, 1, args1, 0, args.length - 1);

        for (i = 0; i < args.length; i++) {
            System.out.println("args[" + i + "] : " + args[i]);
        }

        try {
            Getopts opts = new Getopts(args[0], args1);
            Enumeration names = opts.swList();

            i = 0;
            while (names.hasMoreElements()) {
                OptSwitch cs = opts.getSwitch((Character) names.nextElement());
                System.out.println("args[" + i + "] : " +
                        (char) cs.sw + " " + cs.type + " " +
                        cs.set + " " + cs.val);
                i++;
            }

            String argp[] = opts.argList();
            for (i = 0; i < argp.length; i++) {
                System.out.println("argv[" + i + "] : " + argp[i]);
            }
        }
        catch (InvalidSwitch e) {
            System.out.print(e);
        }
    }
public static void main(String args[]) {
        int i;
        String args1[] = new String[args.length - 1];
        System.arraycopy(args, 1, args1, 0, args.length - 1);

        for (i = 0; i < args.length; i++) {
            System.out.println("args[" + i + "] : " + args[i]);
        }

        try {
            Getopts opts = new Getopts(args[0], args1);
            Enumeration names = opts.swList();

            i = 0;
            while (names.hasMoreElements()) {
                OptSwitch cs = opts.getSwitch((Character) names.nextElement());
                System.out.println("args[" + i + "] : " +
                        (char) cs.sw + " " + cs.type + " " +
                        cs.set + " " + cs.val);
                i++;
            }

            String argp[] = opts.argList();
            for (i = 0; i < argp.length; i++) {
                System.out.println("argv[" + i + "] : " + argp[i]);
            }
        }
        catch (InvalidSwitch e) {
            System.out.print(e);
        }
    }
method for class testing.
<p/>
Invocation:
<PRE>
java Getopts "option set" arg0 arg1 ... argn
</PRE>

@param args arguments passed