diff --git a/CRC.java b/CRC.java index 687e7e9..248e66c 100644 --- a/CRC.java +++ b/CRC.java @@ -1,11 +1,12 @@ public class CRC { public static void main(String[] args) { try { - if (args[1].equals("-e")){ + if (args.length == 1){ Encoding tmp = new Encoding(args[0]); System.out.println(args[0] + tmp.getFcsChars()); - } else if (args[1].equals("-d")){ - Decoding d = new Decoding(args[0]); + } else if (args.length == 3){ + String tmp = args[0] + Character.toString((char) Integer.parseInt(args[1])) + Character.toString((char) Integer.parseInt(args[2])); + Decoding d = new Decoding(tmp); System.out.println(d.getCheck()); } } catch (ArrayIndexOutOfBoundsException e){