code: public String sprintf(Object x)
        throws IllegalArgumentException {
      Enumeration e = vFmt.elements();
      ConversionSpecification cs = null;
      char c = 0;
      StringBuffer sb=new StringBuffer();
      while (e.hasMoreElements()) {
        cs = (ConversionSpecification)
          e.nextElement();
        c = cs.getConversionCharacter();
        if (c=='\0') sb.append(cs.getLiteral());
        else if (c=='%') sb.append("%");
        else {
          if (x instanceof Byte)
            sb.append(cs.internalsprintf(
            ((Byte)x).byteValue()));
          else if (x instanceof Short)
            sb.append(cs.internalsprintf(
            ((Short)x).shortValue()));
          else if (x instanceof Integer)
            sb.append(cs.internalsprintf(
            ((Integer)x).intValue()));
          else if (x instanceof Long)
            sb.append(cs.internalsprintf(
            ((Long)x).longValue()));
          else if (x instanceof Float)
            sb.append(cs.internalsprintf(
            ((Float)x).floatValue()));
          else if (x instanceof Double)
            sb.append(cs.internalsprintf(
            ((Double)x).doubleValue()));
          else if (x instanceof Character)
            sb.append(cs.internalsprintf(
            ((Character)x).charValue()));
          else if (x instanceof String)
            sb.append(cs.internalsprintf(
            (String)x));
          else
            sb.append(cs.internalsprintf(x));
        }
      }
      return sb.toString();
    }
docs: Format an Object.  Convert wrapper types to
  their primitive equivalents and call the
  appropriate internal formatting method. Convert
  Strings using an internal formatting method for
  Strings. Otherwise use the default formatter
  (use toString).
  @param x the Object to format.
  @return  the formatted String.
  @exception IllegalArgumentException if the
  conversion character is inappropriate for
  formatting an unwrapped value.