public static void main(String[] args) {
        Random r = new Random();
        if (args.length == 1) {
            try {
                System.out.println(stringToInt(args[0]));
            }
            catch (Exception e) {
                System.out.println(e.getMessage());
            }
        } else {
            for (int times = 0; times < 10000; ++times) {
                int x = r.nextInt();
                String str = intToString(x);
                System.out.println(x + " " + str);
                assert(x == Integer.parseInt(str));
                str = rand_int_string(r.nextInt(10));
                x = stringToInt(str);
                System.out.println(str + " " + x);
                assert(x == Integer.parseInt(str));
            }
            try {
                stringToInt("123abc");
            }
            catch (Exception e) {
                System.out.println(e.getMessage());
            }
        }
    }