Quite lots of ways..^^^
所在版块:社会百科 发贴时间:2003-01-21 01:15  评分:

用户信息
复制本帖HTML代码
高亮: 今天贴 X 昨天贴 X 前天贴 X 
Try to get familiar with some funny stuffs, like:

class test {

public static void main (String args[]) {
double i = 0.5;
double j = 0.3;
Double result = new Double (i/j);
String output = result.toString();
int index = output.indexOf('.');
System.out.println (output.substring(0,index+1+2));
}//main

}
.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!

Speed Up...
 相关帖子 我要回复↙ ↗回到正文
java里面怎么format number? 辰星   (110 bytes , 648reads )
Quite lots of ways..^^^ maserati   (321 bytes , 360reads )
[SUGGESTION]THIS IS WRONG! 不告诉你   (61 bytes , 219reads )
如果你是说CS1102 lab 0的话 Climbing   (743 bytes , 293reads )
hey!!! 你怎么干这种事? 采心   (55 bytes , 246reads )
lab 0 lah Climbing   (8 bytes , 191reads )
.......是不应该给答案,但也不应该这样地骂。。。 coolapple   (0 bytes , 174reads )
:$ 采心   (85 bytes , 207reads )
haha... 不告诉你   (0 bytes , 186reads )
here SmellsLikeTeenSpirit   (177 bytes , 204reads )