public static void main(final String[] args) {
        embFileName = "output.txt";
        password = "abc123";
        try {
            if (args.length < 1) {
                usage();
                return;
            }
            for (int i = 0; i < args.length; i++) {
                if (!args[i].startsWith("-")) {
                    if (!(args[i].endsWith(".jpg") || args[i].endsWith(".JPG"))) {
                        usage();
                        return;
                    }
                    f = new File(args[i]);
                    continue;
                }
                if (args.length < i + 1) {
                    System.out.println("Missing parameter for switch " + args[i]);
                    usage();
                    return;
                }
                if (args[i].equals("-e")) {
                    embFileName = args[i + 1];
                } else if (args[i].equals("-p")) {
                    password = args[i + 1];
                } else {
                    System.out.println("Unknown switch " + args[i] + " ignored.");
                }
                i++;
            }

            final FileInputStream fis = new FileInputStream(f);
            fos = new FileOutputStream(new File(embFileName));
            extract(fis, (int) f.length(), fos, password);

        } catch (final Exception e) {
            e.printStackTrace();
        }
    }