1.字符串转换成各种数字
String s = "1";
byte b = Byte.parseByte( s );
short t = Short.parseShort( s );
int i = Integer.parseInt( s );
long l = Long.parseLong( s );
Float f = Float.parseFloat( s );
Double d = Double.parseDouble( s );
2.各种数字转换成字符串
String s=String.valueOf(value);
其中value即待转换的数字类型。
3.数字类与数字包装类之间的转换(以int \double为例)
int i = 1;
Integer temp = new Integer( i );
i = temp.intValue();
double d = 1f;
Double temp= new Double( d );
d = temp.doubleValue();