code: public static String format(Object value) {
          if (value instanceof Byte)      return formatByte((Byte) value);
          if (value instanceof Short)     return formatShort((Short) value);
          if (value instanceof Long)      return formatLong((Long) value);
          if (value instanceof Float)     return formatFloat((Float) value);
          if (value instanceof Double)    return formatDouble((Double) value);
          if (value instanceof Character) return formatChar((Character) value);
          if (value instanceof String)    return formatString((String) value);
          if (value instanceof Integer ||
              value instanceof Boolean)   return value.toString();
          else
              throw new IllegalArgumentException("Argument is not a primitive type or a string; it " +
                                                 ((value == null) ?
                                                  "is a null value." :
                                                  "has class " +
                                                  value.getClass().getName()) + "." );
      }
docs: Returns a string representation of a constant value (given in
  standard wrapped representation), quoted and formatted as in
  Java source.