int to string
String.valueOf(int i);

解决方案 »

  1.   

    float to string
    String.valueOf(float i);
      

  2.   

    int to string
    int i
    i.toString()
    float f
    f.toString()
      

  3.   

    好啊,我再整理一遍,大家加油啊,把下面的表填齐了就好了
    String:
    ->int:     Integer.parseInt(str)
    ->float:   Float.parseFloat(str)
    ->double:  Double.parseDouble(str)||Double.valueOf(str)
    ->boolean: Boolean.valueOf(str).booleanValue()
    ->bytes:   str.getBytes()
    ->Date:int:
    ->String:  String.valueOf(intvalue)||intvalue.toString()
    ->int:
    ->float:
    ...float:
    ->String:  String.valueOf(floatvalue)||floatvalue.toString()
    ->int:
    ->float:
      

  4.   

    当然还有
    boolean:
    ->String:bytes:
    ->String:Date:
    ->String:

    大家把自己知道的都填出来
      

  5.   

    parse
    public abstract Date parse(String source,
                               ParsePosition pos)Parse a date/time string according to the given parse position.  For
     example, a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date
     that is equivalent to Date(837039928046).  By default, parsing is lenient: If the input is not in the form used
     by this object's format method but can still be parsed as a date, then
     the parse succeeds.  Clients may insist on strict adherence to the
     format by calling setLenient(false).
    Parameters:source - The date/time string to be parsedpos - On input, the position at which to start parsing; on
                  output, the position at which parsing terminated, or the
                  start position if the parse failed.
    Returns:A Date, or null if the input could not be parsedSee Also:setLenient(boolean)intValue
    public int intValue()
    Returns the value of this Float as an int (by casting to type int). Specified by:
    intValue in class Number
    Returns:
    the float value represented by this object converted to type intfloatValue
    public float floatValue()
    Returns the float value of this Float object. Specified by:
    floatValue in class Number
    Returns:
    the float value represented by this object
      

  6.   

    这些东西在api里面都有,我觉得还是自己看比较好,贴在这里的话不够详细。
      

  7.   

    遇到具体某个类型转换时,往往想不起来或不知道在api中的哪个类里面,这样浪费很多时间弄个简单明了的表,查起来不是很方便嘛,至于用法一看函数名、参数及所在的类名就知道了,不需要很详细的
      

  8.   

    string - > bigdemical  怎么办?
      

  9.   

    错了!,是
    string - >BigDecimal 怎么办?
      

  10.   

    我只会这么几个,还有Double.toStirng
      

  11.   

    String -> int :public static void main(String[] args)int a = Integer.parseInt(args[0]);
      

  12.   

    thanks   hzpike (pike)  
     i am a newman
      

  13.   

    对于原生类型及其包装类
    原生值==>包装类 (new 包装类(原生值))
    包装类==>原装值 (包装类.xxxValue())
    原生类==>String (String.ValueOf(原生值))
    String==>原生类 (包装类parseXXX 、getBoolean等)
    对象 ==>String (object.toString())
    日期 <==>String (java.util.DateFormat.format 或 parse)
      

  14.   

    记这个干什么啊?用多了就记得七七八八了,用一个好的IDE,这个不费脑子
      

  15.   

    楼主提的不全吧还有object->int , String , float.....
      

  16.   

    有谁知道object->int该用什么函数啊