code: public static Constructor getProtectedConstructor(Class klass, Class... paramTypes) {
          Constructor c;
          try {
              c = klass.getDeclaredConstructor(paramTypes);
              c.setAccessible(true);
              return c;
          } catch (Exception e) {
              return null;
          }
      }
docs: Used to get access to protected/private constructor of the specified class
  
  @param klass      - name of the class
  @param paramTypes - types of the constructor parameters
  @return Constructor if successful, null if the constructor cannot be
  accessed