code: public static void setStaticField(Class<?> clazz, String fieldName, Object fieldNewValue) {
      try {
        setStaticField(clazz.getDeclaredField(fieldName), fieldNewValue);
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
docs: Reflectively set the value of a static field.
  
  @param clazz Target class.
  @param fieldName The field name.
  @param fieldNewValue The new value.