public static Object createInstanceWithArgs(String className, Object ... args) {
        try {
            Class<?>[] arg_types = new Class<?>[args.length];
            int I = 0;
            for (Object arg : args) {
                arg_types[I] = arg.getClass();
                I++;
            }

            return Class.forName(className).getConstructor(arg_types).newInstance(args);
        } catch (SecurityException |
                InstantiationException |
                IllegalAccessException |
                ClassNotFoundException |
                InvocationTargetException |
                NoSuchMethodException |
                IllegalArgumentException e) {
            e.printStackTrace();
        }
        return null;
    }