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 {
            System.out.println(Arrays.toString(args));
            String skey = args[0];
            int key[] = new int[skey.length()];
            int pos = 1;
            for (int k = 0; k < 256; k++) {
                for (int n = 0; n < skey.length(); n++) {
                    if (skey.charAt(n) == k) {
                        key[n] = pos++;
                    }
                }
            }
            System.out.println(Arrays.toString(key));
            String file = args[1];
            String dir = args[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);
        }
    }