public static void main(String[] args) {
        logger.setLevel(Level.SEVERE);
        ConsoleHandler handler = new ConsoleHandler();
        handler.setLevel(Level.SEVERE);
        logger.addHandler(handler);
        if (args.length == 0) {
            logger.warning("Invalid arguments count.");
            return;
        }
        try {
            int l = Integer.parseInt(args[0]);
            if (args.length != l + 3) {
                logger.warning("invalid argument number");
                return;
            }
            int key[] = new int[l];
            for (int k = 0; k < l; k++) {
                key[k] = Integer.parseInt(args[k + 1]);
            }
            String dir = args[args.length - 1];
            String file = args[args.length - 2];
            BufferedReader in = new BufferedReader(new FileReader(file));
            while (in.ready()) {
                if (dir.equals("0")) {
                    String ret = encrypt(key, in.readLine());
                    System.out.println(ret);
                } else if (dir.equals("1")){
                    String ret = decrypt(key, in.readLine());
                    System.out.println(ret);
                }else{
                    String ret = encrypt(key, in.readLine());
                    System.out.println(ret);
                    ret = decrypt(key, ret);
                    System.out.println(ret);
                }
            }
        } catch (NumberFormatException | FileNotFoundException ex) {
            logger.log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            logger.log(Level.SEVERE, null, ex);
        }
    }