public static Method getMethodByName(Class<?> clazz, String methodName) {
        if (Objects.nonNull(clazz) && Objects.nonNull(methodName)) {
            Method method = Arrays.stream(clazz.getMethods())
                    .filter(m -> Objects.equals(m.getName(), methodName))
                    .findFirst().orElse(null);
            if (method != null) {
                return method;
            }
            return Arrays.stream(clazz.getDeclaredMethods())
                    .filter(m -> Objects.equals(m.getName(), methodName))
                    .findFirst().orElse(null);
        }
        return null;
    }
@Test
    public void getMethodByNameTest() {
        // private method
        Method runStateLessThan = ReflectUtil.getMethodByName(ThreadPoolExecutor.class, "runStateLessThan");
        Assert.assertNotNull(runStateLessThan);
        // public method
        Method field = ReflectUtil.getMethodByName(TestClass.class, "setPrivateField");
        Assert.assertNotNull(field);
        // parameters
        Method privateField = ReflectUtil.getMethodByName(TestClass.class, "setPrivateField", String.class);
        Assert.assertNotNull(privateField);
    }