各种数字类型转换成字符串型:
String resultstring = String.valueOf( anytypeofdata);

 

字符串型转换成数字类型:
byte b = Byte.parseByte( String sourcestring );
short t = Short.parseShort( String sourcestring );
int i = Integer.parseInt( String sourcestring );
long l = Long.parseLong( String sourcestring );
float f = Float.parseFloat( String sourcestring );
double d = Double.parseDouble( String sourcestring );

 

数字类型与数字类对象之间相互转换:
Byte bo = new Byte( byte b );
byte b = bo.byteValue();
 
Short to = new Short( short t );
short t = to.shortValue();

 

Integer io = new Integer( int i );
int i = io.intValue();

 

Long lo = new Long( long l );
long l = lo.longValue();

 

Float fo = new Float( float f );
float f = fo.floatValue();

 

Double dObj = new Double( double d );
double d = dObj.doubleValue();

 posted on 2006-10-14 23:13  心有灵犀  阅读(237)  评论(0编辑  收藏  举报