code: public static Object tryClone(Object toBeCloned) {
          if (toBeCloned == null) {
              return null;
          }
          Object clonedObj = null;
          if (toBeCloned instanceof Cloneable) {
              try {
                  Method method = Object.class.getDeclaredMethod("clone");
                  method.setAccessible(true);
                  clonedObj = method.invoke(toBeCloned);
              } catch (Exception e) {
                  if (e instanceof CloneNotSupportedException) {
                      clonedObj = toBeCloned;
                  } else {
                      throw e instanceof RuntimeException ? (RuntimeException) e
                              : new RuntimeException(e);
                  }
              }
          } else {
              clonedObj = toBeCloned;
          }
          return clonedObj;
      }
docs: Try cloning an object.
  
  @param toBeCloned
  @return result from object's {@code clone()} method if object implements
  interface {@link Cloneable}, otherwise the same object is
  returned