code: private static String objectToString(Object obj) {
  
      // handle 'null'
      if(obj == null) {
        return "null";
      }
      
      // enclose Strings in quotes
      if(obj instanceof CharSequence) {
        return "\""+obj.toString()+"\"";
      }
  
      // use toString() for all other objects
      return obj.toString();
    }
docs: Helper method to create a string representation of an object.
  
  @param obj the object to print
  @return a string representation of the object